cpp-init

A command that adds C and C++ project checks and configuration to a project already prepared by the anchor command. It detects formatting and lint tools, then can set up build, lint, and sanitizer files for the project's build system.

In plain words
What is it for?
Use it to prepare C or C++ projects using CMake, Meson, Make, or Bazel, including clang-format, clang-tidy, linting, and sanitizer builds.
Why use it?
C and C++ projects use different build systems and may have different tool locations. This command records what was found so later coding sessions do not have to rediscover the setup.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/redtropig/harness-anchor/cpp-init
Clone the repo
git clone --depth 1 https://github.com/Redtropig/harness-anchor
Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,226 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00032 $0.01226
Opus 5 $0.00016 $0.00613
Sonnet 5 $0.00006 $0.00245
Haiku 4.5 $0.00003 $0.00123

Measured 2d ago against content hash 0143b0b463f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cpp-init scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/cpp-init.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/cpp-init

Add the C/C++ config layer to a project already anchored via /anchor. The mechanical work is scripts/scaffold.sh --cpp — same conflict protocol as /anchor, C/C++ template map (init.sh per build system, .clang-format, .clang-tidy, scripts/lint.sh, and scripts/sanitizer-build.sh on CMake).

Steps

  1. Resolve the toolchain before scaffolding config for it:

    bash ${CLAUDE_PLUGIN_ROOT}/scripts/cpp-tool-discovery.sh clang-format clang-tidy
    

    Record each FOUND line's <how> column as well as its path — step 5 branches on <how>, so the path alone is not enough. The point is that a later session never has to rediscover (and mis-conclude) the tool; whether that is best served by a bare name or a recorded path depends on <how>. A NOT_FOUND tool is still worth scaffolding config for (the config is version-controlled; the tool may arrive later) — but say so as "searched PATH + <listed locations>, not found (as of <YYYY-MM-DD>)", never "not installed" / "on this machine". The date is not decoration: this line lands in a git-tracked file that every later session reads, and a tool installed next week will not come back to correct it.

  2. Run the C/C++ scaffold:

    bash ${CLAUDE_PLUGIN_ROOT}/scripts/scaffold.sh --target "$(pwd)" --cpp
    

    Refusals (surface the message, suggest the fix, stop):

    • exit 4 — not anchored: run /anchor first.
    • exit 3 — not a C/C++ project: this command does not apply.
  3. Resolve conflicts exactly as in /anchor step 3 — AskUserQuestion [Overwrite / Skip / Show diff] per conflict, --render <file> (with --cpp) for the diff, then one bash ${CLAUDE_PLUGIN_ROOT}/scripts/scaffold.sh --target "$(pwd)" --cpp --overwrite <f1,f2> call for the approved set. A user-customized init.sh, .clang-format, or .clang-tidy encodes work/taste — that is exactly why they land in conflicts instead of being replaced.

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 93 lines · 32 tokens per session scan A 0143b0b463f5

Subscribe to this mod's changes

cpp-init is a command published in the GitHub repository Redtropig/harness-anchor (13 stars, last pushed 1mo ago), licensed MIT. It adds 32 tokens to every session and 1,226 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.