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.
npx agentmods add instructions/yapie0/carboncode/claude-mdgit clone --depth 1 https://github.com/Yapie0/carboncodeWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02028 | $0.02028 |
| Opus 5 | $0.01014 | $0.01014 |
| Sonnet 5 | $0.00406 | $0.00406 |
| Haiku 4.5 | $0.00203 | $0.00203 |
Grade A, and why
carboncode CLAUDE.md 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.
How it starts
The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
Carbon Code is a Chinese-first, DeepSeek-native terminal coding agent (@carboncode/cli, bins carboncode / ccode), derived from DeepSeek-Reasonix and productized for personal developer workflows. Architecture is opinionated around three pillars: immutable prefix caching, tool-call repair, and tiered flash→pro cost control.
Canonical rules (authoritative — follow these)
AGENTS.md— project rules, PR merge principles, naming/scope, license/attribution. Read before any non-trivial change.CARBON.md— working knowledge: stack, commands, product rules, watch points.- The agent itself loads project rules from
AGENTS.mdthenCARBON.md(read priority order insrc/memory/project.ts:AGENTS.md→CARBON.md→ legacyREASONIX.md→AGENT.md; the legacy two are read-only fallbacks and are not present in this repo).
This file complements those two with an architecture map of src/. It does not restate their rules.
Dev workflow
Node 22+, ESM ("type": "module"). Scripts:
npm run build— tsup +scripts/copy-dashboard-vendor-css.mjs(library + CLI + dashboard bundles, then dashboard CSS copy)npm run dev—tsx src/cli/index.ts(no subcommand);npm run chat—tsx src/cli/index.ts chatnpm run test/npm run test:watch/npm run test:coverage— Vitestnpm run test:mutation— Stryker on load-bearing modules (loop, context-manager, core, shell, plan, repair)npm run lint/npm run lint:fix/npm run format— Biome oversrc testsnpm run typecheck—tsc --noEmitfor src andtsc --noEmit -p dashboardnpm run verify— build + lint + typecheck + test in one shot
Run npm run verify before claiming work is done. Git hooks (simple-git-hooks): pre-commit lint, pre-push verify.
Architecture map (src/)
- CLI & commands —
src/cli/index.ts(entry; importscli/heap-limit-launch.tsFIRST for heap re-exec), Commander program, lazy-importedsrc/cli/commands/*. Top-level commands: setup, code, chat, run, acp, desktop (internal JSON-RPC for the desktop client), stats, doctor, commit, sessions, prune-sessions, events, replay, diff, mcp (list/search/install/browse/inspect), version, update, index. Interactive modes use Ink;src/cli/ui/App.tsxis the main TUI (~4.5k lines).src/cli/resolve.tsresolves precedence (per-setting flag >--preset> config.preset >auto). - Agent engine —
src/loop.tsCacheFirstLoop.step(input)is the turn loop (AsyncGenerator ofLoopEvent);src/loop/*(types, escalation, healing, messages, force-summary, thinking, env),src/context-manager.ts(fold/force-summary/preflight thresholds 50/70/80/95% of ctxMax),src/memory/runtime.ts(ImmutablePrefix + AppendOnlyLog + VolatileScratch),src/frame/(TUI grid primitives — fixed-width cell/row frames),src/core/(events, inflight, pause-gate, pause-policy, reducers, event-redaction, eventize). - Repair —
src/repair/(index.tsorchestrates scavenge → truncation → storm passes for malformed DeepSeek tool calls;flatten.tsschema flatten runs at loop construction). - Tools —
src/tools.ts(ToolRegistryregister/dispatch, plan-mode enforcement, schema flatten/re-nest, result post-processing),src/tools/*(filesystem, shell, shell-chain, web, memory, plan/plan-core, subagent, skills, choice, todo, scaffold, jobs),src/tools/fs/(edit with LCS diff, patch, glob, outline, search),src/tools/shell/parse.ts(allowlist) +exec.ts. Cross-cutting:src/hooks.ts,src/skills.ts,src/at-mentions.ts,src/at-mentions-url.ts. - Model client / net —
src/client.ts(DeepSeekClient: undici SSE streaming, ~11-min (660s) timeout, retry, cache-token usage),src/retry.ts,src/tokenizer.ts(encode-only V4 tokenizer,data/deepseek-tokenizer.json.gz),src/net/proxy.ts,src/adapters/(JSONL event sink/source),src/ports/(ModelClient/MemoryStore/CheckpointStore/EventSink/HookRunner/ToolHost interfaces). - Config / env —
src/config.ts(~/.carboncode/config.json, API key bridge, presets, project permissions, sensitive-path config, MCP),src/env.ts,src/workspaces.ts,src/frontmatter.ts,src/gitignore.ts. - Context / memory / transcript —
src/memory/(session JSONL persistence, user/project/subdir memory, runtime prefix),src/session-title.ts,src/transcript/(log/replay/diff). Sessions/data live under~/.carboncode/sessions/,~/.carboncode/memory/{global,<projectHash>}/. - Semantic index —
src/index/semantic/(builder, store JSONL append-only + linear cosine scan, embedding via Ollama/OpenAI-compat, chunker, tool, ollama-launcher, preflight),src/index/config.ts. Complements lexical grep. - i18n —
src/i18n/(index.tst()/tObj(),types.tsschema,zh-CN.tsprimary,EN.tsfallback). Chinese is first-class; English is fallback only. - Integration surfaces —
src/mcp/(client + stdio/SSE/streamable-http transports, registry, spec, catalog, reconnect, latency),src/acp/(Agent Client Protocol over stdio: server/protocol/dispatch/gates),src/qq/(QQ bot WebSocket channel + access control),src/server/(loopback dashboard HTTP +api/*routes). - Telemetry —
src/telemetry/(usage JSONL at~/.carboncode/usage.jsonl, pricing/stats, subagent distillation). Local-only, no network calls. - Library barrel —
src/index.tsre-exports the public API.
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.
- 2d ago First seen · 56 lines · 2,028 tokens per session scan A e6bcbf1e1603
carboncode CLAUDE.md is an instructions file published in the GitHub repository Yapie0/carboncode (195 stars, last pushed 23d ago), licensed MIT. It adds 2,028 tokens to every session, about $0.0101 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.
Other instructions, from other repositories
dsh-TUI AGENTS.md
AGENTS.md instructions for ccch1mneyyy/dsh-TUI, covering agents.md, 仓库布局, 命令, 上游边界与契约 and 约定与红线.
ds4-control CLAUDE.md
Instructions for notatestuser/ds4-control, covering ds4 control — project guide for claude, purpose, deepseek v4 preview maintenance, stack and dev workflow.
Tianshu-harness CLAUDE.md
Instructions for huiliyi37/Tianshu-harness, covering 天枢 (tianshu) / rivet, build & test, architecture, conventions and known constraints.
cocode AGENTS.md
Instructions for cocode-agency/cocode, covering agents.md, 仓库布局, 仓库边界, cocode-gui/ and cocode-tui/.
peri CLAUDE.md
Instructions for KonghaYao/peri, covering claude.md — perihelion, 先读什么, 跨仓库契约, 任务路由 and 代码定位.
Whale AGENTS.md
AGENTS.md instructions for usewhale/Whale, covering repository guidelines, project structure & module organization, build, test, and development commands, coding style & naming conventions and testing guidelines.