Systems C Cpp
Use this pack for C and C++ systems work: native libraries, performance-sensitive services, device or firmware-adjacent code, build-toolchain work, cross-compilation, and interoperability with lower-level platform APIs. Defer first-pass route choice and lane selection to .opencode/reference/routing-matrix.md.
This is the general C and C++ family pack for the repo. Use the overlay in reference/cmake-gtest-embedded.md to tune decisions for target-based CMake, gtest or CTest, toolchains, and embedded-adjacent constraints while keeping ABI, memory, and performance choices visible.
Core focus
- Design headers, translation units, ABI surfaces, and ownership boundaries so C and C++ code stays readable across toolchains.
- Keep build configuration, compiler flags, sanitizer use, and platform assumptions explicit instead of scattering them through scripts.
- Treat performance, memory layout, and allocation behavior as measurable system properties.
- Support cross-compiling, hardware-adjacent targets, and constrained environments with clear host-versus-target rules.
- Keep tests, benchmarks, and diagnostics close to the code that owns system behavior.
Shared C and C++ standards
- Prefer target-based CMake over global compile or link state when rules differ by library, executable, or test target.
- Keep warnings, language standards, include paths, and preprocessor definitions visible at the target level.
- Separate portable core logic from platform or board-specific code and keep ABI boundaries narrow.
- Use gtest, CTest, sanitizers, and profiling together so correctness and runtime behavior are checked from more than one angle.
- Make allocation limits, threading assumptions, and error handling visible when the code may run under embedded constraints.
Default workflow
- Inspect the repository layout, compiler toolchain, target platforms, and build graph.
- Choose the native-toolchain overlay in
reference/cmake-gtest-embedded.md.
- Define targets, ABI boundaries, memory constraints, and test strategy before broad implementation.
- Implement source layout, build rules, tests, and performance checks together so host and target behavior stay aligned.
- Run
review-work after substantial C or C++ systems changes.
Collaboration in this repo
- Use
Explore before editing so new work matches local target layout, naming, and build conventions.
- Use
Librarian or Context7 when compiler, standard-library, or toolchain behavior needs a source-of-truth check.
- Use
review-work when changes materially affect ABI stability, memory use, performance, or constrained-target behavior.
Overlays
reference/cmake-gtest-embedded.md for toolchains, cross-compiling, target-based CMake, gtest or CTest usage, and embedded-adjacent constraints.
Guardrails
- Do not hide build assumptions in global flags or one-off scripts that make target behavior hard to trace.
- Do not let platform-specific headers, macros, or allocation rules leak across the whole codebase without a clear boundary.
- Do not assume desktop test results prove correctness on a constrained or cross-compiled target.
1---2name: systems-c-cpp3description: Deliver C and C++ systems work across native toolchains, CMake, testing, performance, and constrained targets without hiding ABI or platform assumptions.4---56# Systems C Cpp78Use this pack for C and C++ systems work: native libraries, performance-sensitive services, device or firmware-adjacent code, build-toolchain work, cross-compilation, and interoperability with lower-level platform APIs. Defer first-pass route choice and lane selection to `.opencode/reference/routing-matrix.md`.910This is the general C and C++ family pack for the repo. Use the overlay in `reference/cmake-gtest-embedded.md` to tune decisions for target-based CMake, gtest or CTest, toolchains, and embedded-adjacent constraints while keeping ABI, memory, and performance choices visible.1112## Core focus1314- Design headers, translation units, ABI surfaces, and ownership boundaries so C and C++ code stays readable across toolchains.15- Keep build configuration, compiler flags, sanitizer use, and platform assumptions explicit instead of scattering them through scripts.16- Treat performance, memory layout, and allocation behavior as measurable system properties.17- Support cross-compiling, hardware-adjacent targets, and constrained environments with clear host-versus-target rules.18- Keep tests, benchmarks, and diagnostics close to the code that owns system behavior.1920## Shared C and C++ standards2122- Prefer target-based CMake over global compile or link state when rules differ by library, executable, or test target.23- Keep warnings, language standards, include paths, and preprocessor definitions visible at the target level.24- Separate portable core logic from platform or board-specific code and keep ABI boundaries narrow.25- Use gtest, CTest, sanitizers, and profiling together so correctness and runtime behavior are checked from more than one angle.26- Make allocation limits, threading assumptions, and error handling visible when the code may run under embedded constraints.2728## Default workflow29301. Inspect the repository layout, compiler toolchain, target platforms, and build graph.312. Choose the native-toolchain overlay in `reference/cmake-gtest-embedded.md`.323. Define targets, ABI boundaries, memory constraints, and test strategy before broad implementation.334. Implement source layout, build rules, tests, and performance checks together so host and target behavior stay aligned.345. Run `review-work` after substantial C or C++ systems changes.3536## Collaboration in this repo3738- Use `Explore` before editing so new work matches local target layout, naming, and build conventions.39- Use `Librarian` or `Context7` when compiler, standard-library, or toolchain behavior needs a source-of-truth check.40- Use `review-work` when changes materially affect ABI stability, memory use, performance, or constrained-target behavior.4142## Overlays4344- `reference/cmake-gtest-embedded.md` for toolchains, cross-compiling, target-based CMake, gtest or CTest usage, and embedded-adjacent constraints.4546## Guardrails4748- Do not hide build assumptions in global flags or one-off scripts that make target behavior hard to trace.49- Do not let platform-specific headers, macros, or allocation rules leak across the whole codebase without a clear boundary.50- Do not assume desktop test results prove correctness on a constrained or cross-compiled target.