CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
92/100
Scores the file, not the repository.Length
966 words
6 headings · 1 code blocksRepository
4
— · pushed 5 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md — AI session entry point23SPARDA is **the trust layer for AI-written code** — "AI writes. SPARDA proves."4(ADR-033). Under the hood it is a behavior compiler: backend (code + schema) →5deterministic UBG → proofs (`review`, `apocalypse`), an executable mock6(`mirror`), deterministic replay (`timeless`/`heal`). The MCP layer is the same7trust story at runtime: it parses an Express/FastAPI/Next app (AST), injects a8reversible `/mcp` router *inside the live process*, and bridges it to MCP9clients over stdio. Zero infra, zero budget: compute from the host process,10intelligence from the client's own LLM (MCP sampling), storage from11`sparda.json` + git.1213## Start here, every session14151. Read `docs/HANDOFF.md` — current state: what is done, not done, and next.162. Read the doc that matches your task (map in `docs/README.md`).173. Before touching code that failed before, check `docs/ERRORS.md`.184. Big-picture questions (tiers, rounds, monetization) → `ROADMAP.md`.1920**🚢 PUBLISHING ANYTHING? Read `docs/MASTER-PLAN-RELEASE.md` first, in full.**21npm, the VS Code Marketplace, the MCP registry, a tag — all four go through22that playbook, in that order. Every step in it has already been done wrong23once and carries the error number to prove it. Do not improvise a release.2425**Offload, don't memorise.** Your context is finite and this project's history26is not. Durable facts go INTO the docs (`ERRORS.md`, `DECISIONS.md`,27`HANDOFF.md`, the Obsidian vault); old facts come OUT of them by grep, never28by reconstruction. Do not read `DECISIONS.md` or `ERRORS.md` whole — they are29100+ entries each, and saturating your own context is how confident wrong30process decisions get made.3132**Before ending a session that changed anything:** update `docs/HANDOFF.md`33and append a session record in `docs/sessions/` (use `TEMPLATE.md`).34This is how context survives between sessions — never skip it.3536## Commands3738```bash39npm test # vitest, full suite — must be green before any push40npm run mutation # 128 mutants — all must die before any push (rule 12)41npm run release:check # the RELEASE gate (ADR-087) — green suite ≠ releasable42 # full procedure: docs/MASTER-PLAN-RELEASE.md43npx vitest run -t "quarantine" # single test by name44node src/index.js init|dev|sync|hook|remove|doctor # the CLI, from a target app dir45```4647Tests need Node >= 18 and Python >= 3.9 (FastAPI parser fixtures).4849## Architecture in one breath5051`init`: `detect.js` (framework/entry/port) → `parser/` (routes via AST) →52`security/sanitize.js` (docstring defense) → `generator/` (render53`templates/*.txt` → router file, inject marked block into entry, write54`sparda.json`). `dev`: `server/stdio.js` bridges MCP stdio ↔ the injected55router's HTTP endpoints (`/mcp/tools|invoke|stats|events`). Details and the56`sparda.json` schema: `docs/ARCHITECTURE.md`.5758## Hard rules (violating these breaks the product — see docs/DECISIONS.md)59601. **The host never pays for SPARDA's intelligence.** Nothing heavy on the61 request path; ring buffers bounded; LLM only on surprise, never required.622. **stdout is the MCP protocol.** Human logs go to stderr, always.633. **Write tools are disabled by default** (write-safety); user opt-in only.644. **`sparda remove` must leave a byte-for-byte clean diff.** Injection is65 marked, idempotent, backed up, re-parsed after every modification.665. **Carry-over is sacred:** `localKey`, per-tool `enabled`, `semantic`,67 `immune`, and `labs` survive re-init. Never regenerate them.686. **Templates must stay valid in all variants** (JS/TS × ESM/CJS, Python).69 Placeholders like `__ANY_TYPE__` exist for TS — keep them consistent.707. **Every LLM output is sanitized** (`sanitizeDescription`) before it is71 stored or shown to a client. No exceptions.728. **No new runtime dependency without an entry in `docs/DECISIONS.md`.**73 Currently 4, exact-pinned — that is a selling point.749. **A registration is MODELLED or DECLARED — never dropped.** Every `continue`75 in a registration dispatch either registers something or emits an76 `UnknownHandler` + a high-risk blind spot. Silence is how a real endpoint77 earns a false PROVEN (ADR-079, SOUNDNESS Direction 3).7810. **An oracle may not import an extractor.** `oracle-static.js` and the79 sealing certificates check the analyser against a SECOND implementation;80 one that reuses the analyser's walk is a mirror, and confirms bugs instead81 of finding them (ADR-082).8211. **A guarantee is universal or it is false.** ANY module that grades a compiled83 graph MUST call `premiseFor` — a command, the MCP tool, a bench, the corpus84 oracle. "Grades" means it calls anything in `GRADERS`85 (`tests/premise-wired-everywhere.test.js`): `verdictOf`, `badgeFor`, **and86 `buildCapsule`** — the capsule states `proven` in the artifact that TRAVELS.87 An organ reachable from some consumers buys confidence it has not earned, and88 a rule scoped to one directory — or to one function name — repeats the same89 mistake one level up; both times the gap was the size of the scope90 (ADR-083 + amendment, ADR-093).9112. Tests green (`npm test`) **and** mutants dead (`npm run mutation`) before92 commit; new behavior ships with tests, new soundness-critical lines ship93 with a killing mutant.9413. **Put the admission INSIDE the number, never beside it.** Anything a reader acts95 on — a score, a verdict word, an `ok`, a percentage — must be able to say "I don't96 know" IN ITSELF (`null`, never `0`/`false`/`1`-with-a-note). Five leaks had the97 honest field present and the headline lying (SOUNDNESS 3d, ADR-092). New headline98 field → new row in `tests/unmeasured-is-not-a-pass.test.js`, and the row owes TWO99 assertions: EXPRESSIBLE (the field can hold `null`) **and REACHABLE** (a real call100 path produces it). ADR-092 was tested and wired to nothing for a whole release101 because only the first was checked (E-106, SOUNDNESS 3e).10214. **A green suite licenses a COMMIT, never a RELEASE.** Publishing goes through103 `npm run release:check` — which commit, which tag, which manifests, which104 CHANGELOG entry are all unverified until something checks them, and v0.69.0105 shipped a half-state with every test passing (ADR-087, E-096). No escape hatch.106107## Conventions108109- ESM everywhere, Node >= 18 compatible (no `??=` worries, but check vitest ^3).110- User-facing errors: `Object.assign(new Error(msg), { code: 'USER', hint })`.111- Comments explain *constraints*, not narration; match existing density.112- Commit style: `feat(scope):`, `fix(scope):`, `docs:`, `chore:`.113
Also in zyx77550/sparda
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| zyx77550/spardaGEMINI.md · 4 | GEMINI.md | testlint-formatgitapi+2 | 75/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| livewire/livewireCLAUDE.md · 24k | CLAUDE.md | setupbuildteststyle+4 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today |
