carboncode: Instructions file for Claude Code

CLAUDE.md

carboncode CLAUDE.md is an instructions file for Claude Code from Yapie0/carboncode. It costs 2,028 tokens per session, scanned A, original, MIT.

A repository instruction file for Carbon Code, a Chinese-first terminal coding agent. It records the project's governing rules, development workflow, architecture, and conventions.

In plain words
What is it for?
Use it when making non-trivial changes to Carbon Code, especially changes involving its project rules, Node setup, build process, CLI, dashboard, or source architecture.
Why use it?
It tells coding agents which project documents are authoritative and how the source tree, build commands, and compatibility rules fit together.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions subagents; mentions AGENTS.md.

This is Yapie0/carboncode's own configuration. It tells Claude Code how to work on carboncode itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything carboncode configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Yapie0/carboncode. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Yapie0/carboncode/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/Yapie0/carboncode

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for carboncode CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/yapie0/carboncode/claude-md/github.svg)](https://agentmods.dev/instructions/yapie0/carboncode/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/yapie0/carboncode/claude-md"><img src="https://agentmods.dev/badge/instructions/yapie0/carboncode/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for carboncode CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/yapie0/carboncode/claude-md"><img src="https://agentmods.dev/badge/instructions/yapie0/carboncode/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,028 This file is loaded in full into every session.
When invoked 2,028 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.02028 $0.02028
Opus 5.5 $0.00811 $0.00811
Sonnet 5.5 $0.00406 $0.00406
Haiku 4.5 $0.00203 $0.00203

Measured 2mo ago against content hash e6bcbf1e1603, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 2mo 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.

CLAUDE.md · 56 lines

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.md then CARBON.md (read priority order in src/memory/project.ts: AGENTS.md → CARBON.md → legacy REASONIX.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 chat
  • npm run test / npm run test:watch / npm run test:coverage — Vitest
  • npm 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 over src tests
  • npm run typecheck — tsc --noEmit for src and tsc --noEmit -p dashboard
  • npm 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; imports cli/heap-limit-launch.ts FIRST for heap re-exec), Commander program, lazy-imported src/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.tsx is the main TUI (~4.5k lines). src/cli/resolve.ts resolves precedence (per-setting flag > --preset > config.preset > auto).
  • Agent engine — src/loop.ts CacheFirstLoop.step(input) is the turn loop (AsyncGenerator of LoopEvent); 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.ts orchestrates scavenge → truncation → storm passes for malformed DeepSeek tool calls; flatten.ts schema flatten runs at loop construction).
  • Tools — src/tools.ts (ToolRegistry register/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.ts t()/tObj(), types.ts schema, zh-CN.ts primary, EN.ts fallback). 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.ts re-exports the public API.

Read the full file on GitHub · 56 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. 2mo ago First seen · 56 lines · 2,028 tokens per session scan A e6bcbf1e1603

Subscribe to this mod's changes

carboncode CLAUDE.md is an instructions file published in the GitHub repository Yapie0/carboncode (199 stars, last pushed 2mo ago), licensed MIT. It adds 2,028 tokens to every session, about $0.0081 per session on Opus 5.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.

Related

carboncode CLAUDE.md compared with instructions from other repositories

carboncode CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
carboncode CLAUDE.mdYapie0/carboncodeInstructions file1992mo agoMITA2,028Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file275k2d agoMITA4,313Codex, OpenCode