Skip to content

Commit a787a2a

Browse files
cpp-tools agents.md
1 parent 9be423f commit a787a2a

2 files changed

Lines changed: 14 additions & 30 deletions

File tree

AGENTS.md

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# AGENTS.md — LiveKit C++ Client SDK
22

3+
## Shared C++ Baseline
4+
5+
Follow `cpp-tools/AGENTS.md` for shared C++ rules and this file for SDK-specific
6+
guidance.
7+
8+
Before C++ work, verify the shared guidance and root `.clang-format` /
9+
`.clang-tidy` symlinks are present. If not, flag it and recommend
10+
`git submodule update --init cpp-tools` or `./cpp-tools/install.sh` as
11+
appropriate. Never use `--force` without approval or claim tooling verification
12+
while these prerequisites are missing. Project-specific commands are documented
13+
in `docs/tools.md`.
14+
315
## Project Overview
416

517
This is **client-sdk-cpp**, the official LiveKit C++ client SDK. It wraps a Rust core (`client-sdk-rust/`) via a protobuf-based FFI bridge. All WebRTC, networking, and media logic lives in Rust; the C++ layer provides an ergonomic API for C++ consumers.
@@ -76,7 +88,7 @@ Be sure to update the directory layout in this file if the directory layout chan
7688
| `src/tests/` | Google Test integration and stress tests |
7789
| `examples/` | In-tree example applications |
7890
| `client-sdk-rust/` | Git submodule holding the Rust core of the SDK|
79-
| `cpp-tools/` | Git submodule holding shared LiveKit C++ clang-format / clang-tidy configs, scripts, docs, and CI workflow |
91+
| `cpp-tools/` | Git submodule holding shared LiveKit C++ engineering guidance, clang-format / clang-tidy configs, scripts, docs, and CI workflow |
8092
| `client-sdk-rust/livekit-ffi/protocol/*.proto` | FFI contract (protobuf definitions, read-only reference) |
8193
| `cmake/` | Build helpers (`protobuf.cmake`, `spdlog.cmake`, `nlohmann_json.cmake`, `LiveKitConfig.cmake.in`) |
8294
| `docker/` | Dockerfile for CI and SDK distribution images |
@@ -306,33 +318,12 @@ internal symbols are too noisy to enforce) and `WARN_AS_ERROR = FAIL_ON_WARNINGS
306318
so any other warning (broken `@ref`, unknown `@command`, unsupported HTML tag,
307319
malformed table, missing `@param` on a documented function, …) fails the build.
308320

309-
### Integer Types
310-
311-
- Prefer fixed-width integer types from `<cstdint>` (`std::int32_t`, `std::uint64_t`, etc.) over raw primitive integer types when size or signedness matters.
312-
- This applies in public APIs, FFI/protobuf-facing code, serialized payloads, handles, timestamps, IDs, and any cross-platform boundary where integer width must be explicit.
313-
- Use raw primitive integer types only when the value is intentionally platform-sized or when preserving an existing public API is necessary for backwards compatibility.
314-
- Do not change an existing public API from a raw primitive integer type to a fixed-width type for style consistency alone unless the compatibility impact has been reviewed.
315-
316-
### Git Practices
317-
318-
- Use `git mv` when moving or renaming files.
319-
320321
### CMake
321322

322323
- spdlog is linked **PRIVATE** to the `livekit` target. It must not appear in exported/installed dependencies.
323324
- protobuf is vendored via FetchContent on non-Windows platforms; Windows uses vcpkg.
324325
- The CMake install produces a `find_package(LiveKit CONFIG)`-compatible package with `LiveKitConfig.cmake`, `LiveKitTargets.cmake`, and `LiveKitConfigVersion.cmake`.
325326

326-
### Readability and Performance
327-
328-
Code should be easy to read and understand. If a sacrifice is made for performance or readability, it should be documented.
329-
330-
Adhere to clang-format checks configured in `.clang-format`, which is installed as a symlink to `cpp-tools/.clang-format`. Run `./cpp-tools/clang-format.sh --path src --path include --path benchmarks` to confirm code styling, or add `--fix` to rewrite files.
331-
332-
### Static Analysis
333-
334-
Adhere to clang-tidy checks configured in `.clang-tidy`, which is installed as a symlink to `cpp-tools/.clang-tidy`. Run `./cpp-tools/clang-tidy.sh` with the repository-specific build directory and filters documented in `docs/tools.md`.
335-
336327
## Dependencies
337328

338329
| Dependency | Scope | Notes |
@@ -374,13 +365,6 @@ Integration tests (`src/tests/integration/`) cover: room connections, callbacks,
374365
When adding new client facing functionality, add a new test case to the existing test suite.
375366
When adding new client facing functionality, add benchmarking to understand the limitations of the new functionality.
376367

377-
## General C++ Development
378-
379-
- Do not use dynamic memory allocation after initialization
380-
- Keep each function short (roughly ≤ 60 lines)
381-
- Declare all data objects at the smallest possible level of scope
382-
- Each calling function must check the return value of nonvoid functions, and each called function must check the validity of all parameters provided by the caller
383-
384368
## Common Pitfalls
385369

386370
- A `Room` with `auto_subscribe = false` will never receive remote audio/video frames — this is almost never what you want.

cpp-tools

0 commit comments

Comments
 (0)