Merge feature/context-diet into develop
This commit is contained in:
commit
9a20ca797b
58 files changed
+703
-148
No files matched your search
@@ -1155,6 +1155,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Alternatives rejected**: path-scope Design work / Web sections into `rules/` (BDR-031 principle; the design hook needs the section in context regardless of file type); caveman doctrine (BDR-031: instructions-to-follow must stay prose); raise the 320 guard again (BDR-062 already moved it once; a guard that follows the file is not a guard).
|
||||
- **Status**: accepted, on chore/claude-global-density, UNMERGED (human gate). make test unchanged (2 pre-existing T16a), banner density warning gone, doctor 0 errors.
|
||||
- **Reference**: `CLAUDE.global.md`, `hooks/session-start.sh` (320 guard), `hooks/design-toolchain-reminder.sh` (heading match). Links [[BDR-031]], [[BDR-062]], [[BDR-085]].
|
||||
- **Status (2026-10-29)**: accepted, amended by BDR-130 (2026-10-29): Design work path-scoped in rules/web-building.md, hook = Read pointer
|
||||
|
||||
## BDR-099 — C2 coherence: 30 doctrine/skill tensions resolved, doctrine wins, BDR-068 kept as the written exception
|
||||
- **Date**: 2026-09-24
|
||||
@@ -1337,6 +1338,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Hooks**: interviewer FAILURE MODES row (language not stated → propose Rust), init-project founding-BDR table, project CLAUDE.md exception list.
|
||||
- **Alternatives rejected**: section in CLAUDE.global.md (busts 320 budget); `paths:`-scoped rule (brainstorm is chat, never fires).
|
||||
- **Refs**: commit ee76723, branch chore/rust-default. Links [[BDR-085]].
|
||||
- **Status (2026-10-29)**: accepted, amended by BDR-130 (2026-10-29): Rust default moved to lib/architecture-defaults.md, chat covered by the always-on line
|
||||
|
||||
## BDR-119 — impeccable = Build path for all UI, frontend-design out of the gate [accepted] (2026-10-16)
|
||||
- **Decision**: Build UI routes to impeccable (init, shape, new-work, craft floor, `impeccable detect`, fresh finish reviewer). `design.profile` GATE-BLOCK: impeccable in, frontend-design out. frontend-design stays installed + profile-listed: light path for a one-off visual w/o project context, never beside impeccable on same task.
|
||||
@@ -1351,6 +1353,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Why**: user ask. Dashboard-only items (spend cap, WAF, budget stop) stay MANUAL, never claimed done. Scanner proves absence of protection, never presence of security; clean scan = "no static finding". Calibrated on 8 real projects, each FP class fixed + locked by benign test.
|
||||
- **Alternatives rejected**: Rust scanner (interpreted skill script, no build step, default-language contraindication, same rank as explain-diff checker); section in CLAUDE.global.md (budget); `paths:`-scoped rule (never fires in chat/brainstorm); semgrep rules only (blind to migrations, policies, consent flow).
|
||||
- **Refs**: branch feature/secure-by-default, suite `lib/tests/guardrails-scan.test.sh` (89 checks). Links [[BDR-085]] [[BDR-118]].
|
||||
- **Status (2026-10-29)**: accepted, amended by BDR-130 (2026-10-29): Supabase/cloud-functions bodies → path rules, one always-on line each
|
||||
|
||||
## BDR-121 — Guardrails fix loop reuses the bugfix circuit, scanner = oracle [accepted] (2026-10-18)
|
||||
- **Decision**: after report, proposals (route plan) -> prose approval gate -> bugfixer + verify-secure gates -> re-pass. Each accepted fix = contract criterion, CHECK = `scan.py --assert-absent RULE:path` (marker GUARDRAILS-CLEAR, positive control: fails before fix). Re-pass = `--baseline` vs pre-fix scan (GUARDRAILS-NO-NEW). 2 rounds max, residuals open. `--report-only` keeps audit alone.
|
||||
@@ -1397,6 +1400,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Amendment 6 (2026-10-25, shell deny probe)**: bench `.claude/tasks/plans/2026-10-25-bash-deny-probe/`. Native Bash deny matcher sees through compound ops, subshell, `env`/`command`/`timeout`/`nohup`/`xargs`, quoted command word, simple assignments: no per-rule shell duplication. Misses `sh -c`, bare shell + heredoc, `$(…)` command, absolute path, interpreters, quoted literal arg. Under `defaultMode: auto` classifier approved every miss. rtk-rewrite hook runs before permission eval, deny evaluated on rewritten cmd: `git push origin :feature` → `rtk git push …` bypasses `git push * :**` (ac23cc6) and ask `git push *`; `cat */*.pem` likewise. Redirects into Edit-denied path denied. `ask` beats `allow`. User: stay auto, fixes go in phase 2 (rtk rc=3 passthrough + rtk read twins, targeted ask/deny rules, limits written down, routing guard covers Bash writes). Interim risk accepted with the phase order.
|
||||
- **Amendment 7 (2026-10-25, Fable re-challenge of the whole queue)**: 4 lenses + native-features guide (CLI 2.1.308), synthesis `.claude/tasks/plans/2026-10-25-context-mod-queue-challenge.md` § RE-CHALLENGE. BLOCKER closed: hard_deny names off switches only, never mod paths/sources (classifier would refuse mod maintenance). Merge gate = native `ask` rules (`Bash(bash */gitflow.sh finish*)`, `Bash(gitflow_finish*)`, `Bash(git merge *)`), bench r3 G1-G7 all denied, `start` free; `$.ui.ask` mod dropped; BDR-068 /close auto-finish costs one click (user accepted). Routing guard hosted in model-router: `runMain` wrong signal (BEST tier only, never ends), mod state plugin-private; free when `turnMain.source ∈ {skill, model}` or `/route` sticky; Edit/Write/NotebookEdit only, Bash write forms deferred (no measured evasion). Interpreters (`python3 -c` 211, `node -e` 450 calls / 14 days) → soft_deny prose, not static ask; `Bash(/*)` dropped (kills rtk abs twins). Commit-msg hook deferred (4/78 overrun, hooks miss 6/7 repos on core.hooksPath). 4a shrunk: memory.sh add/status/journal/check/index + flock, own-header `[tag]` first then last status line wins (reconcile.sh:60-67 dropped own header = BLK-032..034 false-open), Index blocks removed via /prune-memory, no Meta backfill, no English validator (1/1,290), per-file v2 marker. Phase 1: design section appended to rules/web-building.md (hook one-liner, 2,131 fires), one lib/architecture-defaults.md, Supabase/functions keep always-on line (path rules fail open at scaffold), agent description diet at source, origin line already shipped. Phase 5: lib/profiles/<name>.json source of truth (no generator), detection via /plugin-check (no fingerprint), cleanup += toggle-external.sh + old-layout writers, migrate auto memories before autoMemoryEnabled:false, enable scope = --settings copy else settings.local, never user scope mid-skill. Phase 3 CONDITIONAL on the measured residual after 0/4a/1/5/2: listing filter, contexts field, hint classifier, agent rewrite, higgsfield deltas dropped. 4c = intent rerank + error 4-gram only, digest in session-start.sh on compact/clear; 4b redacts at capture, bounded ring; 4d deferred. Proof budget: static glob check + InstructionsLoaded log for path rules, model canaries for hook/mod levers only.
|
||||
- **Amendment 8 (2026-10-25, model per project and per conversation)**: user ask (one Claude Code conversation per project, often concurrent: Fable on one, opus on another). Measured headless (scratchpad modeltest): project `.claude/settings.local.json` `"model"` wins over user settings, `--settings '{"model":…}'` wins over both; same scopes as packs. `/model` writes the TRACKED user settings.json (fable landed there 2026-10-25): never the per-project route. Applied: tracked default `opus`, this repo local `claude-fable-5-1[1m]`. Phase 5 profile = `enabledPlugins` + `model`; doctor warns when tracked `model` ≠ `opus`. Residuals accepted by the user: interpreters (`python3 -c`, `node -e`) rest on prose + classifier (491/661 calls from sub-agents, an ask rule would fail executors); Bash write forms out of the routing guard until a measured evasion.
|
||||
- **Status (2026-10-29)**: accepted, phase 1 shipped 2026-10-29 (BDR-130): next phase 5
|
||||
|
||||
|
||||
## BDR-126 — model-router `/model <name>` scope dialog: project / conversation / everywhere [accepted] (2026-10-25)
|
||||
@@ -1426,3 +1430,16 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Why**: Index drifted (16 rows missing), status in 3 places, BLK-032..034 false-open (prose words), no single writer (ad hoc Edit/python on 357k files). Phase 4a of [[BDR-125]].
|
||||
- **Alternatives rejected**: `flock(1)` (absent on macOS, [[BDR-110]]); `mkdir` lock (uutils 0.10 not atomic, [[LRN-236]]); generated Index kept (drift by construction, [[LRN-055]]); upgrade via /prune-memory curation (no oracle); strict parser on v1 (regressed 4 of 13 repos: title-suffix, `date: · status:`, `**Statut** :`).
|
||||
- **Refs**: contract `.claude/tasks/contracts/2026-10-27-memory-v2-write-2030.md`, plan + spec `docs/superpowers/{plans,specs}/2026-10-27-memory-v2-write*`, commits a423594..aab9e4d, upgrade 9698473. [[LRN-237]], [[EVAL-052]].
|
||||
|
||||
## BDR-130 — Phase 1 context diet: native carriers per section, one always-on line where chat needs it [accepted] (2026-10-29)
|
||||
- **Context**: BDR-125 phase 1, feature/context-diet (4bbb3c5..789a2b2), contract `.claude/tasks/contracts/2026-10-28-context-diet-1944.md`.
|
||||
- **Decision**: each always-on section → native carrier matching its trigger, no mod. Design work → `rules/web-building.md` (hook one-liner says Read it); graphify usage → `hooks/session-start.sh` block only when `graphify-out/graph.json` exists (threshold + one reminder clause stay, sub-agents never see the banner); never SPA + Rust default → `lib/architecture-defaults.md` Read by init-project/interviewer/scaffolder/ship-feature STEP 1/onboard/audit-delta, one always-on line under `# Architecture decisions`; Web APIs → `rules/rest-api.md` § Versioning; Supabase/cloud-functions bodies → `rules/supabase.md` / `rules/cloud-functions.md`, one always-on line each saying Read before writing a new file; `"autoMemoryEnabled": false`; 13 agent descriptions ≤ 200 chars.
|
||||
- **Measured**: `/context` 30.5k → 26.2k; own gain ≈ −2.8k (Memory files 9.6k → 8.0k, System prompt 4.4k → 3.7k, Custom agents 2.6k → 2.1k); MCP instr 2.4k → 0.9k external.
|
||||
- **Accepted costs**: analyzer `memory: project` dropped with auto memory (dirs empty, user pick); `**/functions/**` fires in non-cloud dirs; Supabase owner-policy detail not always-on.
|
||||
- **Amends**: BDR-118, BDR-120 (moved out of always-on; chat covered by always-on line), BDR-098 (Design work path-scoped, hook = pointer).
|
||||
- **Deferred**: Skill-routing lines → skill descriptions (TODO phase 3 bullet).
|
||||
|
||||
## BDR-131 — settings.json is a base file: /model never committed, UI writes stashed [accepted] (2026-10-29)
|
||||
- **Decision**: tracked `settings.json` = base file. `/model` writes never committed (model per project lives in `.claude/settings.local.json`); tracked default `"model": "opus"`, `"switchModelsOnFlag": true` stays. UI-written keys (`"theme"`) stay uncommitted, stashed around `gitflow finish` (`git stash push -- settings.json`, finish, pop); re-pushed only for a major change.
|
||||
- **Why**: user 2026-10-29: "il ne faut jamais suivre le model… le model par defaut est opus… push un fichier de base, ensuite toute modifs auto on les stash". Never `git checkout`/`restore` the live file (symlink of ~/.claude/settings.json).
|
||||
- **Rejected**: commit `/model` + theme as is (doctor warns tracked ≠ opus).
|
||||
@@ -413,3 +413,9 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
||||
- **Method**: 2 plan-challenge rounds (3 lenses each, reference lib run before the plan), 8 task reviews, 4 fix rounds on Task 8, verifier ×2, security gate, controller proof on 14 repo copies, opus xhigh final review + scoped re-review.
|
||||
- **Anomalies**: each layer caught what earlier green layers missed. Challenge: two classifiers, BLK-019/020 false-open, uutils mkdir lock. Task reviews: G4 guard dodged by string split (rejected), `###` verdict flip ×4 shapes. Verifier: 3 EVAL Index actions lost. Controller proof: template path after `-C` (relative call only). Opus final, after all gates green: lock spin on unwritable `.git` (no rc), bare-prefix `status BLK` writing BLK-001, bullet-list Index facts dropped (trucks_at_work), 59+106 duplicate Date lines (`**Date** :` spacing). One implementer tried `--no-verify` in a temp repo (denied).
|
||||
- **Action**: keep the full stack for libs that rewrite user data; add a real-data copy proof with the user's own invocation before the final review. [[BDR-129]], [[LRN-237]].
|
||||
|
||||
## EVAL-053 — ship-feature phase 1 context diet: challenge, final review and gates (2026-10-29)
|
||||
- **Checked**: ship-feature phase 1 run quality (8 tasks, sonnet executors + reviewers, one haiku transcription).
|
||||
- **Method**: 3-lens plan challenge + confirmation pass, per-task reviews, final opus/xhigh whole-branch review, GATE 0 oracles (10 runnable, c1-*.sh positive-controlled before work), fresh verifier, security gate.
|
||||
- **Anomalies**: challenge found 4 MAJOR (c1-readers red mid-Task 3, worktree vs in place, finish blocked by user settings hunks, contract out of sync with r2); final review found the new-file Write gap (I1) everybody missed; verifier 1st run died on Fable credits (429), retry pinned opus; 2nd run ECARTS(5) all human micro-gate items (approved text not on disk, transient docs out of scope, 2 SC2016 waivers); every per-task review clean first pass.
|
||||
- **Action**: keep oracles + positive control before dispatch; brief reviewers on new-file Write semantics for path rules; record gate texts on disk (contract) so the verifier can match them.
|
||||
@@ -668,3 +668,6 @@ rules:
|
||||
|
||||
## 2026-10-28
|
||||
- Phase 4a memory v2 shipped on feature/memory-v2-write: lib/memory.sh single writer, registries v2 (9698473), shared parser fixes BLK-032..034, upgrade migrates 12/14 repos on copies (game, trucks_at_work refused). 2 challenge rounds + 8 task reviews + 4 Task 8 fix rounds + verifier x2 + opus final (lock spin, bare-prefix status, bullet Index). BDR-129, LRN-236, LRN-237, EVAL-052. Merge on user go.
|
||||
|
||||
## 2026-10-29
|
||||
- Phase 1 context diet (feature/context-diet): 8 tasks SDD + final opus review (I1 Write gap fixed 789a2b2), GATE 0 MET, verifier CONFORME 21/21 after 2 micro-gates, security PASS. /context 30.5k → 26.2k (own −2.8k). Load proof: faunosteo supabase.md + web-building.md, game cloud-functions.md + supabase.md path_glob_match. robin_petier BDR-075 (auto memory migrated, chore/memory-lan-server). BDR-130/131, LRN-238..241, EVAL-053. Faunosteo/game: nothing lost.
|
||||
@@ -1833,3 +1833,19 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
## LRN-237 — A migration oracle sharing the transform reader proves nothing: own range per reader, assert on the entry, prove with the user invocation (2026-10-28)
|
||||
- **Context**: memory v2 `upgrade` verdict oracle, 2026-10-28. Oracle compared each blocker's open/closed verdict, legacy reader before vs strict reader after. Four review rounds each found a range leak the oracle shared: `###` entry invisible to v1 reader counted closed → `resolved` written on an open blocker; `## BLK-003` range swallowed a following `### BLK-001`; a `### ` heading quoted in a fence ended the range; status lines inside a fence read. Tests stayed green because they checked the reconcile enumerator, blind to `###`. Separately: template path derived after `-C` cd → upgrade rc 2 only when the lib is called by relative path; implementers always used absolute paths.
|
||||
- **Apply**: an oracle sharing the transform's reader proves nothing: give each reader its own entry range (end at next heading of any level, fence-aware, skip fenced status). Assert on the entry itself, not via an enumerator. Prove a CLI on real data copies with the invocation users type (relative path + `-C`). Resolve a lib's own dir at source time (`cd -P` before any `cd`). [[BDR-129]], [[LRN-096]].
|
||||
|
||||
## LRN-238 — Path rules match gitignore-style and load on Read only: pointers say Read before writing (2026-10-29)
|
||||
- **Pattern**: engine path-rule match = gitignore-style. InstructionsLoaded logs globs normalized (`**/supabase/**` → `**/supabase`, `rules/**` → `rules`), match at any depth, hidden dirs included. Load on Read only, never Write of new file.
|
||||
- **Application**: an always-on pointer to a path rule must say "Read it before writing a new <file>", not "loads on X files". Plan, spec and user approval all missed it; final opus review caught it (I1, fixed 789a2b2). Static compgen check proves parsing only; load proof = logged headless session naming the Read tool.
|
||||
|
||||
## LRN-239 — Live Claude Code rewrites settings.json from memory on its next settings write (2026-10-29)
|
||||
- **Pattern**: running Claude Code re-serializes its in-memory settings into user `settings.json` on any later settings write: a `/model` "Everywhere" value + key order came back after a manual restore (seen 2026-10-29, twice).
|
||||
- **Application**: after `/model` in a live session, restore the tracked file, then re-check before any commit or finish; stash UI writes (BDR-131). Restart ends it.
|
||||
|
||||
## LRN-240 — autoMemoryEnabled false also drops sub-agent memory: project (2026-10-29)
|
||||
- **Pattern**: `"autoMemoryEnabled": false` also removes a sub-agent's `memory: project` section. Proof 2026-10-29: analyzer asked for its agent-memory section → NO; same probe with `claude -p --settings '{"autoMemoryEnabled": true}'` → YES "# Persistent Agent Memory".
|
||||
- **Application**: before toggling auto memory, check `memory:` frontmatter users and `.claude/agent-memory/*` contents (here 4 dirs, all empty: no loss). Dead field `memory: project` in agents/analyzer.md → TODO.
|
||||
|
||||
## LRN-241 — Classify a usage log by source before trusting its counts (2026-10-29)
|
||||
- **Pattern**: design-toolchain fire log 2026-10-28: 2,779 fires = 1,770 suite prompts (tests ran with the real HOME) + 857 `<agent-message` hand-backs + 152 real prompts. TODO's "2,131 fires" premise was noise.
|
||||
- **Application**: classify a usage log by prompt prefix and known test strings before using its counts as evidence; hook suites run under a temp HOME (fixed 4bbb3c5).
|
||||
@@ -9,15 +9,18 @@ Modular instruction files loaded by Claude Code alongside the global memory.
|
||||
projects). One rule = one file = one concern.
|
||||
|
||||
A rule WITH `paths:` YAML frontmatter (glob list) loads lazily — only when
|
||||
Claude reads a file matching a glob; a rule WITHOUT it loads at session
|
||||
start, same cost as the global memory. Extract from CLAUDE.global.md only
|
||||
what can be path-scoped (the token win) or what is generated; always-on
|
||||
doctrine stays in CLAUDE.global.md. Exception: a standalone user-authored
|
||||
rule set that would bust the 320-line density budget may live here WITHOUT
|
||||
`paths:` (always-on load) — writing-style.md (BDR-085), default-language.md
|
||||
(BDR-118), secure-by-default.md (BDR-120). `paths:` globs match against the
|
||||
CURRENT project's tree — a broad glob (e.g. `rules/**`) can fire in foreign
|
||||
projects; keep rule bodies tiny.
|
||||
Claude Reads a file matching a glob (never on the Write of a new file;
|
||||
sub-agents too); a rule WITHOUT it loads at session start, same cost as the
|
||||
global memory. Doctrine leaves CLAUDE.global.md only for a carrier that fires
|
||||
when it is needed (BDR-125 phase 1: a path rule, a hook, a lib our skills
|
||||
Read), with one always-on line wherever plain chat still needs the rule.
|
||||
Exception: a standalone user-authored rule set that would bust the 320-line
|
||||
density budget may live here WITHOUT `paths:` (always-on load) —
|
||||
writing-style.md (BDR-085), secure-by-default.md (BDR-120);
|
||||
`lib/tests/user-rules.test.sh` locks that set. `paths:` globs match against
|
||||
the CURRENT project's tree, gitignore-style (a pattern without an inner `/`
|
||||
matches at any depth, hidden dirs included) — a broad glob (e.g. `rules/**`)
|
||||
can fire in foreign projects; keep rule bodies tiny.
|
||||
Docs: https://code.claude.com/docs/en/memory.md#path-specific-rules
|
||||
|
||||
Machine-owned: `rules/context7.md` is DELETED BY DESIGN (BDR-053,
|
||||
|
||||
+10
-1
@@ -41,7 +41,16 @@ Shared rules for every phase:
|
||||
- Citers: capitalize, close, prune-memory, CAPITALIZE steps of feat/bugfix/hotfix/ship-feature/commit-change, lib/capitalize-commit.md, lib/analyze-before-plan.md, lib/reconcile.sh, templates/memory, onboard/init-project; doctrine-citers census. CLAUDE.global.md Memory registries: write only via lib/memory.sh; fix the false "load every session" premise (keep caveman: it keeps reads and injections small).
|
||||
- Proof: writer round-trip, flock race test (two adds), status parser on the three false-open BLKs + fixtures, v1 project untouched, `make test` green.
|
||||
|
||||
- [ ] **Phase 1, native context diet: no mod** (redesigned 2026-10-24, shrunk 2026-10-25: one carrier per section, existing files first)
|
||||
- [x] **Phase 1, native context diet: no mod** (redesigned 2026-10-24, shrunk 2026-10-25: one carrier per section, existing files first)
|
||||
- Done 2026-10-29 on feature/context-diet (4bbb3c5..789a2b2): BDR-130, BDR-131, LRN-238..241, EVAL-053. `/context` 30.5k → 26.2k (own −2.8k). Verifier CONFORME 21/21, security PASS. Contract `.claude/tasks/contracts/2026-10-28-context-diet-1944.md` § PROOF.
|
||||
- [ ] User step: delete the auto-memory leftovers by hand (`~/.claude/projects/-home-bchanot-Documents-{faunosteo,jeux-deploy,robin-petier}/memory/`); doctor warns until then.
|
||||
- [ ] Remove the dead `memory: project` field from agents/analyzer.md (auto memory off drops it, LRN-240).
|
||||
- [ ] Deferred (gate 2026-10-29): "Skill routing" lines → our skills' `description:` (phase 3 bullet said phase 1 cleanup).
|
||||
- [ ] Census blind spots: nested `lib/<dir>/x.md § Y`, templates/ and .claude/rules/ outside doctrine-citers.
|
||||
- [ ] Measure the design hook's "Read … first" re-Read cost (instructions-loaded log) before adding "once per session".
|
||||
- [ ] Probe: path rules seen injected after a Bash `sed -n` read (final review M8): confirm Read-only semantics before a later phase relies on it.
|
||||
- [ ] Minor: relative `rules/supabase.md` paths in interviewer.md / guardrails SKILL.md beside absolute ones; agent description losses ("dispatcher applies", "no dispatch", gate-in-dispatcher; security-auditor names no dispatcher).
|
||||
- [ ] robin_petier `chore/memory-lan-server` (BDR-075): merge on user go (approved 2026-10-29).
|
||||
- Facts 2026-10-24 (scratchpad pathtest, memtest): a `paths:` rule loads on Read of a matching file, NOT on Write of a new file; `"autoMemoryEnabled": false` removes the auto-memory system section; classic SessionStart / UserPromptSubmit hooks inject additionalContext; instruction files reload on compaction natively. `hooks/design-toolchain-reminder.sh` fired 2,131 times (16 to 210 per day); `brainstorming` is vendored and gitignored (.gitignore:78), an edit there does not persist.
|
||||
- Section → carrier:
|
||||
- auto-memory system section → `"autoMemoryEnabled": false` in settings.json. Before: migrate existing auto memories in faunosteo, jeux-deploy, robin_petier into their registries (user review), doctor warns when an auto-memory dir is non-empty.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
# CONTRACT — context-diet (phase 1)
|
||||
- date: 2026-10-28 | flow: ship-feature | branch: feature/context-diet (off develop 017a28b)
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
continue avec la phase suivante
|
||||
|
||||
(user, 2026-10-28, after the phase 4a merge 017a28b. Queue order in `.claude/tasks/TODO.md` (BDR-125): 0 → 4a → 1 → 5 → 2 → 3 → 4b-4d, so "la phase suivante" = the TODO bullet "**Phase 1, native context diet: no mod**", its spec read verbatim from that bullet plus the "Shared rules for every phase" block above it.)
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: Architecture defaults (Rust default, public site never SPA, API /api/v1) leave always-on context for lib/architecture-defaults.md; BDR-118/BDR-120 rejected such moves because brainstorm happens in plain chat. What stays always-on? / A: one always-on line in CLAUDE.global.md naming the three defaults and pointing to the lib; rules/default-language.md moves into the lib (file deleted); /refactor not edited (it has no whole-project mode, the line covers it). [gated 2026-10-28, pass A]
|
||||
Q: Which of the 5 auto memories migrate before `autoMemoryEnabled: false`? / A: one entry into robin_petier's registry (LAN dev server: never restart unprompted, ask before killing one found running) via memory.sh on a chore/* branch, text reviewed by the user before the write; the other 4 dropped (onecmd = robin_petier BLK-017, restore = BLK-016/LRN-066/067, faunosteo docker = its resolved BLK, jeux-deploy `:branch` refspec contradicts the gitflow delete doctrine and its project is gone). The user removes the ~/.claude/projects/*/memory dirs by hand afterwards; doctor warns while one is non-empty. [gated 2026-10-28, pass A]
|
||||
Q: Supabase and cloud-functions bodies to path rules: names and globs? / A: rules/supabase.md on `**/supabase/**`, `**/*supabase*.*`; rules/cloud-functions.md on `**/functions/**`, `**/serverless.*`, `**/firebase.json`; one always-on line stays under each heading of rules/secure-by-default.md (Supabase: RLS everywhere + no service_role key client-side; cloud functions: instance cap + no self-trigger). No `**/*.sql` nor `**/migrations/**`. [gated 2026-10-28, pass A]
|
||||
Q: Neighbouring defects in scope? / A: all three in: (a) design-toolchain test F1-F10 run with a temp HOME (1,770 of 2,779 logged fires are suite prompts); (b) lib/project-rules.sh:22-23 comment corrected (engine matching is gitignore-style, observed in the InstructionsLoaded log) and the static proof accounts for it; (c) the design hook stops firing on harness-generated `<agent-message` turns (857 of 2,779 logged fires). [gated 2026-10-28, pass A]
|
||||
|
||||
Q: STEP 3 gate (plan r3, 0441e56)? / A: plan approved; robin_petier entry text approved as shown (robin_petier = finished project, serves as the test case of the auto-memory → registry migration; faunosteo and game (orbistep) are the critical ones: the proof states explicitly that nothing of theirs is lost); settings.json: never commit a `/model` write, the tracked default stays `"model": "opus"`, `"switchModelsOnFlag": true` stays; UI-written changes (`"theme"`) are stashed, never committed, re-pushed only for a major change; Skill-routing lines → skill descriptions (TODO phase 3 bullet) DEFERRED to a TODO line; contract amendments below accepted. [gated 2026-10-29]
|
||||
|
||||
Q: `autoMemoryEnabled: false` also drops the analyzer's `memory: project` section (proved 2026-10-29 with a control run `--settings '{"autoMemoryEnabled": true}'`: YES vs NO); the 4 `.claude/agent-memory/analyzer/` dirs are empty. Keep false? / A: keep false + record a BDR; removing the dead `memory: project` field from agents/analyzer.md = TODO line. [gated 2026-10-29]
|
||||
|
||||
Q: GATE 1 ECARTS(5), human-only points: (1) robin_petier BDR-075 = the text approved at the STEP 3 gate? (2) docs/superpowers/specs/2026-10-29-context-diet-design.md and docs/superpowers/plans/2026-10-29-context-diet.md in FILE SCOPE? (3) authorize two `# shellcheck disable=SC2016 # literal backticks in the fixture` (lib/tests/doctrine-citers.test.sh fixture printf, same waiver as the file's existing line; and the plan doc that quotes it)? / A: yes to all three: BDR-075 is the approved text (byte-identical to the gate text); the two transient pipeline docs join FILE SCOPE (purged by gitflow finish, BDR-065); both SC2016 waivers authorized. [gated 2026-10-29]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. settings.json carries `"autoMemoryEnabled": false`.
|
||||
CHECK: jq -e '.autoMemoryEnabled == false' settings.json >/dev/null && echo AUTOMEM-OFF
|
||||
EXPECT: AUTOMEM-OFF
|
||||
EVIDENCE: MET exit=0 marker-found :: AUTOMEM-OFF
|
||||
2. robin_petier's registry holds exactly one new entry for the LAN dev server rule, written by `lib/memory.sh -C ~/Documents/robin_petier add`, on a `chore/*` branch of that repo, with the text the user approved; no other project's `.claude/memory/` changes.
|
||||
3. doctor warns when any `~/.claude/projects/*/memory/` dir holds a file, names how many dirs, and stays silent when all are empty (flip-tested in a suite with a temp HOME).
|
||||
[gated 2026-10-29] amended: doctor prints a warn line naming the count when a dir holds a file, a pass line otherwise; the proof is the function-level suite (lib/tests/doctor-automem.test.sh) including a call through a temp HOME; doctor also checks the `~/.claude/rules` symlink and that settings.json `autoMemoryEnabled` is false.
|
||||
4. CLAUDE.global.md has no `## Design work` heading; rules/web-building.md ends with the section `## Design work — full toolchain (tiered by scope)`, body identical to the CLAUDE.global.md section at develop 017a28b (internal pointers excepted, listed in the plan); web-building.md `paths:` unchanged.
|
||||
CHECK: bash .claude/tasks/contracts/c1-design-moved.sh
|
||||
EXPECT: DESIGN-MOVED
|
||||
EVIDENCE: MET exit=0 marker-found :: DESIGN-MOVED
|
||||
5. hooks/design-toolchain-reminder.sh prints a one-liner that names `~/.claude/rules/web-building.md` and the heading fragment `full toolchain`, and no longer says "already in context"; its suite asserts the exact new line.
|
||||
6. The design hook stays quiet on a prompt starting with `<agent-message` even when it carries UI tokens (new D-test), and still fires on F1-F10.
|
||||
7. lib/tests/design-toolchain-reminder.test.sh runs every hook call under a temp HOME: a suite run leaves ~/.claude/logs/design-toolchain-fires.log unchanged.
|
||||
CHECK: L="$HOME/.claude/logs/design-toolchain-fires.log"; a=$(wc -l < "$L"); bash lib/tests/design-toolchain-reminder.test.sh >/dev/null 2>&1 || exit 1; b=$(wc -l < "$L"); [ "$a" = "$b" ] && echo LOG-UNTOUCHED
|
||||
EXPECT: LOG-UNTOUCHED
|
||||
EVIDENCE: MET exit=0 marker-found :: LOG-UNTOUCHED
|
||||
8. [gated 2026-10-29] amended: `## graphify` keeps the threshold rule plus ONE reminder clause (`graphify query` before raw grep, `graphify update .` after code edits; sub-agents never see the banner); the full usage body moves as below. Original: CLAUDE.global.md `## graphify` keeps only the threshold rule; the usage body (query/path/explain, wiki/GRAPH_REPORT, `graphify update .`) is printed by hooks/session-start.sh only when the repo root holds `graphify-out/graph.json`; a suite proves present-with-graph and absent-without (flip).
|
||||
9. lib/architecture-defaults.md exists and holds the "Public websites — never SPA" text and the "Default language — Rust" text (wording identical to their sources at 017a28b, pointers excepted) plus the Web APIs rule or a pointer to rules/rest-api.md § Versioning; CLAUDE.global.md has no `## Public websites` and no `## Web APIs` heading and holds one always-on line naming Rust default, never SPA, `/api/v1` and the lib path; rules/default-language.md no longer exists.
|
||||
CHECK: bash .claude/tasks/contracts/c1-arch-moved.sh
|
||||
EXPECT: ARCH-MOVED
|
||||
EVIDENCE: MET exit=0 marker-found :: ARCH-MOVED
|
||||
10. Readers name the lib: skills/init-project/SKILL.md, skills/ship-feature/SKILL.md (STEP 1), skills/onboard/SKILL.md, agents/interviewer.md, agents/scaffolder.md, skills/audit-delta/SKILL.md; no tracked file under skills/ agents/ lib/ hooks/ rules/ templates/ nor CLAUDE.global.md cites `default-language.md`.
|
||||
CHECK: bash .claude/tasks/contracts/c1-readers.sh
|
||||
EXPECT: READERS-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: READERS-OK
|
||||
11. rules/rest-api.md `## Versioning` carries the full versioning rule (text of CLAUDE.global.md § Web APIs at 017a28b), no "Not repeated here"; lib/project-archetypes/rest-api-node.md cites rules/rest-api.md instead of CLAUDE.md "Web APIs — always versioned".
|
||||
12. rules/supabase.md and rules/cloud-functions.md exist with the clarified one-line JSON `paths:` and the bullets of secure-by-default.md §4 / §6 at 017a28b, wording identical; secure-by-default.md keeps the `## 4. Supabase` and `## 6. Cloud functions` headings with one line each naming the critical rule and the path rule.
|
||||
CHECK: bash .claude/tasks/contracts/c1-supabase-functions.sh
|
||||
EXPECT: SB-CF-MOVED
|
||||
EVIDENCE: MET exit=0 marker-found :: SB-CF-MOVED
|
||||
13. A make-test suite parses every rules/*.md frontmatter (one-line JSON `paths:` or none) and locks the always-on set to exactly writing-style.md + secure-by-default.md; positive control: a multi-line `paths:` fixture and an extra always-on fixture both fail it.
|
||||
14. lib/project-rules.sh header comment states the observed engine matching (trailing `/**` dropped, a pattern matches at any depth, hidden dirs included, evidence: InstructionsLoaded `globs: ["rules"]` on `.claude/rules/*.md`) instead of "the engine's matcher skips" dotfiles; code behaviour unchanged.
|
||||
15. Load proof (controller, journaled): one fresh headless session per moved path rule, each prompt naming the Read tool on a real file, logs `path_glob_match` for rules/supabase.md (faunosteo), rules/cloud-functions.md (game, supabase/functions), rules/web-building.md (a UI file); and `bash lib/project-rules.sh -C <project> matches '<glob>'` per new glob in the project that holds it (a glob that matches nowhere is named in the journal).
|
||||
16. Every tracked agents/*.md `description:` (the 4 vendored impeccable-* excepted) is ≤ the length settled at the plan gate; agent names, files and `model:` lines unchanged.
|
||||
CHECK: bash .claude/tasks/contracts/c1-agent-desc.sh
|
||||
EXPECT: AGENT-DESC-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: AGENT-DESC-OK (23 agents)
|
||||
17. Citers patched in the same branch: CLAUDE.global.md Skill routing (Design / UI line, Higgsfield line), lib/design-gate.md, agents/seo-analyzer.md, .claude/rules/rules-maintenance.md (always-on exception list and the "always-on doctrine stays in CLAUDE.global.md" sentence), hooks/session-start.sh comments citing BDR-031 / the moved sections; doctrine-citers census green.
|
||||
18. CLAUDE.global.md is ≤ 320 lines (the session banner density warning goes away).
|
||||
CHECK: n=$(wc -l < CLAUDE.global.md); [ "$n" -le 320 ] && echo GLOBAL-UNDER-320
|
||||
EXPECT: GLOBAL-UNDER-320
|
||||
EVIDENCE: MET exit=0 marker-found :: GLOBAL-UNDER-320
|
||||
19. `/context` after (controller, `claude -p "/context"` at repo root, journaled with the baseline 2026-10-28: total 30.5k, Memory files 9.6k with user CLAUDE.md 7.4k / default-language 409 / secure-by-default 1.2k, Custom agents 2.6k, System prompt 4.4k): Memory files and Custom agents both lower, rules/default-language.md absent from the Memory files table.
|
||||
20. make test all green and shellcheck clean.
|
||||
CHECK: make test 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
21. shellcheck clean on the health stack.
|
||||
CHECK: shellcheck *.sh hooks/*.sh lib/*.sh && echo SHELLCHECK-CLEAN
|
||||
EXPECT: SHELLCHECK-CLEAN
|
||||
EVIDENCE: MET exit=0 marker-found :: SHELLCHECK-CLEAN
|
||||
|
||||
## FILE SCOPE
|
||||
CLAUDE.global.md, settings.json, rules/web-building.md, rules/rest-api.md, rules/secure-by-default.md, rules/default-language.md (deleted), rules/supabase.md (new), rules/cloud-functions.md (new), lib/architecture-defaults.md (new), hooks/design-toolchain-reminder.sh, lib/tests/design-toolchain-reminder.test.sh, hooks/session-start.sh, lib/graphify-gate.sh (only if the graph-present branch needs it), a session-start graphify suite (new), doctor.sh + one lib/doctor-*.sh + its suite (new), lib/tests/ user-rules suite (new) + fixtures, lib/tests/graphify-gate.test.sh (the session-start graphify checks live there) [gated 2026-10-29], lib/tests/effort-routing.test.sh (one lock retargeted) [gated 2026-10-29], lib/tests/doctrine-citers.test.sh (census extension) [gated 2026-10-29], skills/guardrails/SKILL.md (citer) [gated 2026-10-29], .claude/tasks/contracts/2026-10-28-context-diet-1944.md + c1-*.sh [gated 2026-10-29], .claude/tasks/TODO.md [gated 2026-10-29], docs/superpowers/specs/2026-10-29-context-diet-design.md + docs/superpowers/plans/2026-10-29-context-diet.md (transient, purged at finish) [gated 2026-10-29], lib/project-rules.sh (comment only), agents/*.md (23 tracked, `description:` only), skills/init-project/SKILL.md, skills/ship-feature/SKILL.md, skills/onboard/SKILL.md, skills/audit-delta/SKILL.md, agents/interviewer.md, agents/scaffolder.md, agents/seo-analyzer.md, lib/design-gate.md, lib/project-archetypes/rest-api-node.md, .claude/rules/rules-maintenance.md, .claude/tasks/contracts/c1-*.sh (oracles), robin_petier `.claude/memory/` (one entry, its own chore/* branch), docs at STEP 8.
|
||||
|
||||
## PROOF — controller, 2026-10-29
|
||||
- c2 (robin_petier): `chore/memory-lan-server` started by `gitflow.sh start`, `memory.sh -C ~/Documents/robin_petier add decision --status accepted` → BDR-075 (v1 registry, stderr note), memory commit d16cd6e via memory-commit.sh rc 0, pushed; `git -C ~/Documents/{faunosteo,game} status --short` empty. Critical projects: faunosteo's only auto memory (dev-host-no-docker-access) already lives in its blockers.md (docker.sock BLK, resolved 2026-10-08); game's auto-memory dir is empty; jeux-deploy's (remote-git-ops) dropped by the pass-A answer (contradicts the gitflow delete doctrine). Nothing of faunosteo/game is lost.
|
||||
- c15 static: `project-rules.sh -C <proj> matches`: faunosteo `**/supabase/**` → packages/supabase, `**/*supabase*.*` → apps/app/src/lib/supabase.ts; game `**/supabase/**` → supabase, `**/*supabase*.*` → apps/web/src/progress/supabase.ts, `**/functions/**` → supabase/functions; robin_petier and zenquality: all five globs match nothing (no Supabase text loads there); `**/serverless.*` and `**/firebase.json` match nowhere in the four projects.
|
||||
- c15 load (`~/.claude/logs/instructions-loaded.jsonl`, headless `claude -p` naming the Read tool): 2026-10-29T12:14:26Z faunosteo `supabase.md` User path_glob_match on packages/supabase/package.json (globs logged `**/supabase,**/*supabase*.*`), `web-building.md` User on apps/app/e2e/harness/dialog.tsx; 12:14:36Z game `cloud-functions.md` + `supabase.md` User on supabase/functions/_shared/core.mjs (globs `**/functions,…`). Both repos clean after.
|
||||
- c19 `/context` after (repo root, headless): total 30.5k → 26.2k; Memory files 9.6k → 8.0k (user CLAUDE.md 7.4k → 6.3k, secure-by-default 1.2k → 985, default-language row gone); System prompt 4.4k → 3.7k (auto-memory section); Custom agents 2.6k → 2.1k. MCP server instructions 2.4k → 945 is NOT this branch (claude.ai connector set changed between the runs): own gain ≈ −2.8k.
|
||||
- analyzer `memory: project`: dropped by `autoMemoryEnabled: false` (control `--settings '{"autoMemoryEnabled": true}'` → section present); dirs empty; user kept false [gated 2026-10-29].
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# GATE 0 oracle, contract context-diet c16: every tracked agent description
|
||||
# ≤ 200 chars as written; file list and every other frontmatter key unchanged.
|
||||
set -u
|
||||
python3 -I - <<'PY'
|
||||
import subprocess, sys, yaml
|
||||
def ls(rev=None):
|
||||
cmd = ['git', 'ls-tree', '-r', '--name-only', rev, 'agents'] if rev else ['git', 'ls-files', 'agents']
|
||||
out = subprocess.run(cmd, capture_output=True, text=True, check=True).stdout.split()
|
||||
return sorted(f for f in out if f.endswith('.md') and not f.startswith('agents/resources/'))
|
||||
def fm(text):
|
||||
if not text.startswith('---\n'): return None, None
|
||||
head = text.split('\n---\n', 1)[0][4:]
|
||||
raw = next((l for l in head.splitlines() if l.startswith('description:')), '')
|
||||
return yaml.safe_load(head), raw[len('description: '):]
|
||||
now, old = ls(), ls('017a28b')
|
||||
if now != old: print('agent file list changed'); sys.exit(1)
|
||||
bad = []
|
||||
for f in now:
|
||||
meta, raw = fm(open(f, encoding='utf-8').read())
|
||||
prev, _ = fm(subprocess.run(['git', 'show', '017a28b:' + f], capture_output=True, text=True).stdout)
|
||||
if not isinstance(meta.get('description'), str) or len(raw) > 200: bad.append(f'{f}: {len(raw)} chars')
|
||||
if {k: v for k, v in meta.items() if k != 'description'} != {k: v for k, v in prev.items() if k != 'description'}:
|
||||
bad.append(f'{f}: other keys changed')
|
||||
if bad: print('\n'.join(bad)); sys.exit(1)
|
||||
print(f'AGENT-DESC-OK ({len(now)} agents)')
|
||||
PY
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# GATE 0 oracle, contract context-diet c9: architecture defaults in the lib,
|
||||
# verbatim; one always-on line in CLAUDE.global.md; default-language.md gone.
|
||||
set -u
|
||||
fail() { echo "$1"; exit 1; }
|
||||
L=lib/architecture-defaults.md
|
||||
body() { awk -v h="$1" 'index($0, h) == 1 { f = 1; print; next } f && /^#/ { exit } f'; }
|
||||
[ -f "$L" ] || fail "no $L"
|
||||
[ -e rules/default-language.md ] && fail "rules/default-language.md still exists"
|
||||
grep -q '^## Public websites' CLAUDE.global.md && fail "Public websites in CLAUDE.global.md"
|
||||
grep -q '^## Web APIs' CLAUDE.global.md && fail "Web APIs in CLAUDE.global.md"
|
||||
a=$(git show 017a28b:CLAUDE.global.md | body '## Public websites — never SPA')
|
||||
b=$(body '## Public websites — never SPA' < "$L")
|
||||
[ -n "$a" ] && [ "$a" = "$b" ] || fail "SPA section differs"
|
||||
a=$(git show 017a28b:rules/default-language.md | sed '1s/^# /## /')
|
||||
b=$(body '## Default language — Rust' < "$L")
|
||||
[ -n "$a" ] && [ "$a" = "$b" ] || fail "language section differs"
|
||||
grep -q 'rules/rest-api.md' "$L" || fail "no rest-api.md pointer in the lib"
|
||||
line=$(awk '/^# Architecture decisions/ { f = 1; next } f && /^#/ { exit } f' CLAUDE.global.md \
|
||||
| tr '\n' ' ')
|
||||
for w in 'Rust by default' 'never a SPA' '/api/v1/' '~/.claude/lib/architecture-defaults.md'; do
|
||||
case "$line" in *"$w"*) ;; *) fail "architecture line lacks: $w" ;; esac
|
||||
done
|
||||
echo ARCH-MOVED
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# GATE 0 oracle, contract context-diet c4: Design work moved verbatim to
|
||||
# rules/web-building.md (last section), gone from CLAUDE.global.md, paths kept.
|
||||
set -u
|
||||
fail() { echo "$1"; exit 1; }
|
||||
sec() { awk '/^## Design work — full toolchain/ { f = 1; print; next }
|
||||
f && /^#/ { exit } f'; }
|
||||
old=$(git show 017a28b:CLAUDE.global.md | sec)
|
||||
[ -n "$old" ] || fail "no source section at 017a28b"
|
||||
grep -q '^## Design work' CLAUDE.global.md && fail "still in CLAUDE.global.md"
|
||||
new=$(sec < rules/web-building.md)
|
||||
[ "$old" = "$new" ] || { diff <(printf '%s\n' "$old") <(printf '%s\n' "$new"); fail "body differs"; }
|
||||
tail_=$(awk '/^## Design work — full toolchain/ { f = 1 } f' rules/web-building.md)
|
||||
[ "$tail_" = "$new" ] || fail "not the last section"
|
||||
[ "$(git show 017a28b:rules/web-building.md | sed -n 2p)" = "$(sed -n 2p rules/web-building.md)" ] \
|
||||
|| fail "paths changed"
|
||||
echo DESIGN-MOVED
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# GATE 0 oracle, contract context-diet c10: the readers name the lib; no
|
||||
# tracked doctrine file still cites rules/default-language.md.
|
||||
set -u
|
||||
for f in skills/init-project/SKILL.md skills/ship-feature/SKILL.md \
|
||||
skills/onboard/SKILL.md agents/interviewer.md agents/scaffolder.md \
|
||||
skills/audit-delta/SKILL.md agents/seo-analyzer.md; do
|
||||
grep -q 'lib/architecture-defaults.md' "$f" || { echo "no lib in $f"; exit 1; }
|
||||
done
|
||||
if git grep -n 'default-language\.md' -- skills agents lib hooks rules templates \
|
||||
.claude/rules CLAUDE.global.md ':!lib/tests'; then
|
||||
echo "stale default-language.md citer"; exit 1
|
||||
fi
|
||||
echo READERS-OK
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# GATE 0 oracle, contract context-diet c12: Supabase / cloud-functions bodies
|
||||
# moved verbatim to path rules; secure-by-default keeps one bullet each and
|
||||
# every other section byte-identical to 017a28b.
|
||||
set -u
|
||||
fail() { echo "$1"; exit 1; }
|
||||
S=rules/secure-by-default.md
|
||||
sect() { awk -v h="$1" '$0 == h { f = 1; next } f && /^## / { exit } f && NF'; }
|
||||
bullets() { awk '/^- / { f = 1 } f && NF' "$1"; }
|
||||
for r in supabase cloud-functions; do [ -f "rules/$r.md" ] || fail "no rules/$r.md"; done
|
||||
[ "$(sed -n 2p rules/supabase.md)" = 'paths: ["**/supabase/**", "**/*supabase*.*"]' ] \
|
||||
|| fail "supabase.md paths"
|
||||
[ "$(sed -n 2p rules/cloud-functions.md)" = 'paths: ["**/functions/**", "**/serverless.*", "**/firebase.json"]' ] \
|
||||
|| fail "cloud-functions.md paths"
|
||||
[ "$(git show "017a28b:$S" | sect '## 4. Supabase')" = "$(bullets rules/supabase.md)" ] \
|
||||
|| fail "supabase bullets differ"
|
||||
[ "$(git show "017a28b:$S" | sect '## 6. Cloud functions')" = "$(bullets rules/cloud-functions.md)" ] \
|
||||
|| fail "cloud-functions bullets differ"
|
||||
one() { # one <heading> <word>… → the section holds one bullet carrying every word
|
||||
local t; t=$(sect "$1" < "$S"); shift
|
||||
[ "$(printf '%s\n' "$t" | grep -c '^- ')" = 1 ] || return 1
|
||||
t=$(printf '%s' "$t" | tr '\n' ' ')
|
||||
for w in "$@"; do case "$t" in *"$w"*) ;; *) return 1 ;; esac; done
|
||||
}
|
||||
one '## 4. Supabase' RLS service_role rules/supabase.md || fail "§4 line"
|
||||
one '## 6. Cloud functions' 'Max instances' self-trigger rules/cloud-functions.md || fail "§6 line"
|
||||
strip() { awk '/^## / { skip = ($0 == "## 4. Supabase" || $0 == "## 6. Cloud functions"); print; next } !skip'; }
|
||||
[ "$(git show "017a28b:$S" | strip)" = "$(strip < "$S")" ] || fail "other sections changed"
|
||||
echo SB-CF-MOVED
|
||||
+2
-2
@@ -30,7 +30,7 @@ claude-config/
|
||||
├── mods/ # Claude Code mods (function-hooks plugins), loaded through the skills/<name> symlink
|
||||
├── skills-external/ # Vendored skill packs: gstack submodule, design skills, superpowers, agent-skills, MengTo scroll skills, 21st and Higgsfield packs (machine-owned copies gitignored)
|
||||
├── templates/ # Per-project templates (CLAUDE.md, settings, memory registries, path-rule skeletons, deploy runbook, gitignore)
|
||||
└── lib/ # Shared libs: gitflow, memory registry writer, profiles, vendoring, route doctrine, gates, archetypes, project-rule oracle, tests
|
||||
└── lib/ # Shared libs: gitflow, memory registry writer, profiles, vendoring, route doctrine, gates, archetypes, architecture defaults, project-rule oracle, tests
|
||||
```
|
||||
|
||||
## Architecture principles
|
||||
@@ -39,4 +39,4 @@ claude-config/
|
||||
- `agents/` = execution units called by skills (never invoked directly by user)
|
||||
- `mods/` = Claude Code mods (function-hooks plugins); each loads through the tracked symlink `skills/<name>` as `<name>@skills-dir`, live at the next session; `mods/model-router/routing.json` (tracked) holds the phase table (tier, effort and the `about` line the first-use dialog shows), every skill and agent row and the first-use decisions
|
||||
- `templates/` = symlinked to `~/.claude/templates/` — copy into projects via `/onboard` or manually
|
||||
- **Graphify** builds a knowledge graph of any codebase (`/graphify query`), producing a navigable wiki in `graphify-out/wiki/`. This map helps Claude understand project structure, find relevant code faster, and reason across files. Essential for large-scope tasks (multi-file features, complex bugs, architectural changes). Small tasks should skip it and read files directly. Proposed only from 200 tracked code files: the session-start banner informs, the user decides; nothing builds a graph without that go.
|
||||
- **Graphify** builds a knowledge graph of any codebase (`/graphify query`), producing a navigable wiki in `graphify-out/wiki/`. This map helps Claude understand project structure, find relevant code faster, and reason across files. Essential for large-scope tasks (multi-file features, complex bugs, architectural changes). Small tasks should skip it and read files directly. Proposed only from 200 tracked code files: the session-start banner informs, the user decides; nothing builds a graph without that go. Where `graphify-out/graph.json` exists, the session-start hook prints the graphify usage rules.
|
||||
+5
-1
@@ -7,7 +7,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- **Secure-by-default guardrails**: `rules/secure-by-default.md` (always on) makes six domains baseline on every project, plus systematic API and access hygiene (auth on every route, CORS, secrets, passwords hashed with argon2id or bcrypt, never compared in clear, logged or hardcoded): hosting (rate limit, CDN and firewall, hard spend cap), Supabase (RLS on every table, owner-scoped policies, no service role key client-side), SMS and email (recorded consent, unsubscribe, STOP), cloud functions (no self-trigger, instance cap, budget stop), injection (bound values in raw escapes, `format()` for dynamic SQL, allowlisted filters, no shell into a DB tool), exposure (no data in the console, no production source map, no debug flag, no secret in hydrated state, data attributes, hidden fields or shipped comments). `/guardrails` audits them: a stdlib Python scanner (`skills/guardrails/scripts/scan.py`, FAIL / WARN / MANUAL, exit 1 on FAIL) then judgment, report in `.claude/audits/GUARDRAILS.md`. The security-auditor gate runs the scanner's `api` and `supabase` domains and blocks on FAIL. Items only a provider dashboard can set stay MANUAL, never claimed done. An optional read-only live probe (`skills/guardrails/scripts/probe.py`, `--live`) confirms a finding from outside on a target the user owns and names: anon-read, cross-user, no-auth route, CORS reflection and a capped rate-limit burst, verdicts OPEN / CLOSED / SKIPPED / ERROR. An `exposure` block in the plan adds three read-only probes, meant for a production build or a staging URL: a served or inline source map for the page's scripts, a stack trace in a 404 or a user-named error route, sensitive keys in a JSON response (identifier-shaped names printed, never values); a target the probe could not observe is SKIPPED or ERROR, never CLOSED, and every plan path must start with `/`. It sends GET, HEAD and OPTIONS only (one opt-in POST burst, capped at 25), requires `--authorized`, takes secrets from the environment never the command line, never follows a redirect to another host, and stops at a request budget. After the report, `/guardrails` proposes fixes (plan phase, so Fable when the router can switch), applies only the ones the user accepts through the `bugfixer` executor and the `lib/verify-secure-loop.md` gates, then re-scans: each accepted fix is a contract criterion whose oracle is the scanner (`--assert-absent RULE:path`, marker `GUARDRAILS-CLEAR`), and a full pass against the pre-fix baseline (`--baseline`, marker `GUARDRAILS-NO-NEW`) catches regressions; a live probe replays on the user's go; two rounds at most, residuals reported open; `--report-only` keeps the audit alone. Suites: `lib/tests/guardrails-scan.test.sh` (clean fixture plus one mutant per rule, check modes, `gates.sh` integration) and `lib/tests/guardrails-probe.test.sh` (probe logic against a localhost fixture server).
|
||||
- **Secure-by-default guardrails**: `rules/secure-by-default.md` (always on) makes six domains baseline on every project (the Supabase and cloud-function detail lives in the path rules `rules/supabase.md` and `rules/cloud-functions.md`), plus systematic API and access hygiene (auth on every route, CORS, secrets, passwords hashed with argon2id or bcrypt, never compared in clear, logged or hardcoded): hosting (rate limit, CDN and firewall, hard spend cap), Supabase (RLS on every table, owner-scoped policies, no service role key client-side), SMS and email (recorded consent, unsubscribe, STOP), cloud functions (no self-trigger, instance cap, budget stop), injection (bound values in raw escapes, `format()` for dynamic SQL, allowlisted filters, no shell into a DB tool), exposure (no data in the console, no production source map, no debug flag, no secret in hydrated state, data attributes, hidden fields or shipped comments). `/guardrails` audits them: a stdlib Python scanner (`skills/guardrails/scripts/scan.py`, FAIL / WARN / MANUAL, exit 1 on FAIL) then judgment, report in `.claude/audits/GUARDRAILS.md`. The security-auditor gate runs the scanner's `api` and `supabase` domains and blocks on FAIL. Items only a provider dashboard can set stay MANUAL, never claimed done. An optional read-only live probe (`skills/guardrails/scripts/probe.py`, `--live`) confirms a finding from outside on a target the user owns and names: anon-read, cross-user, no-auth route, CORS reflection and a capped rate-limit burst, verdicts OPEN / CLOSED / SKIPPED / ERROR. An `exposure` block in the plan adds three read-only probes, meant for a production build or a staging URL: a served or inline source map for the page's scripts, a stack trace in a 404 or a user-named error route, sensitive keys in a JSON response (identifier-shaped names printed, never values); a target the probe could not observe is SKIPPED or ERROR, never CLOSED, and every plan path must start with `/`. It sends GET, HEAD and OPTIONS only (one opt-in POST burst, capped at 25), requires `--authorized`, takes secrets from the environment never the command line, never follows a redirect to another host, and stops at a request budget. After the report, `/guardrails` proposes fixes (plan phase, so Fable when the router can switch), applies only the ones the user accepts through the `bugfixer` executor and the `lib/verify-secure-loop.md` gates, then re-scans: each accepted fix is a contract criterion whose oracle is the scanner (`--assert-absent RULE:path`, marker `GUARDRAILS-CLEAR`), and a full pass against the pre-fix baseline (`--baseline`, marker `GUARDRAILS-NO-NEW`) catches regressions; a live probe replays on the user's go; two rounds at most, residuals reported open; `--report-only` keeps the audit alone. Suites: `lib/tests/guardrails-scan.test.sh` (clean fixture plus one mutant per rule, check modes, `gates.sh` integration) and `lib/tests/guardrails-probe.test.sh` (probe logic against a localhost fixture server).
|
||||
- **/a11y skill**: accessibility leaves `/guardrails` and becomes its own skill. Same A11Y-* rules (img alt, field label, click without keyboard, focus outline removed, positive tabindex) on the shared scan engine (`skills/guardrails/scripts/scanner.py`, a `Catalogue` per CLI; `skills/a11y/scripts/scan.py`, markers `A11Y-CLEAR` / `A11Y-NO-NEW`), a Tab-only walk of the main flow on `--live` through `/browse` (marked not done otherwise), report `.claude/audits/A11Y.md`, fixes proposed with the alt and label wording as the user's choice, applied through the bugfix circuit (`bugfixer`, verify-secure gates, `bugfix/a11y-<date>`), re-pass against a baseline. The keyboard, alt and label doctrine moves from `rules/secure-by-default.md` to the lazy `rules/a11y.md` (loads on UI files only; `rules/web-building.md` points at it). `/guardrails` scans `injection` (INJ-*) and `exposure` (EXP-*) instead, with per-language SQL patterns, shared `code_files` / `hits` / `dedupe_lines` / `client_reachable` helpers and a walker that lists files over 1 MB by path; `--domain a11y` is a usage error there. `/web-validate` keeps full WCAG conformance. Suite `lib/tests/a11y-scan.test.sh`; routing row `reflect`; profiles audit, dev, web, web-full, full, max.
|
||||
- **model-router mod**: `mods/model-router/`, a Claude Code mod (function-hooks plugin), routes every repo skill and agent from phase rows (`plan`, `reflect`, `orchestrate`, `escalate`, `judge`, `audit`, `implement`, `write`, `verify`, `explore`, `apply`, `mechanical`; built-ins Explore on sonnet/medium, Plan on opus/xhigh). A typed skill routes the main loop to its row, and a best-tier row holds across turns in a run slot until `/route clear`, `/route off`, a user `/model` or a typed skill on a non-best row. Agents get their row's model at spawn (within the tier, upward only) and its effort on every step; explicit Agent params win. Orchestrators declare their phases through the `mcp__model-router__route` tool. `ultrathink` in a prompt sets the turn's minimum effort and `/route effort=max` holds until `/route clear`; the built-in `/effort` is not a lever inside a run. `/route show` names the run slot (`main: run <phase>`), and a `null` row in the override drops a default row. The model gets a `route` tool and the user a `/route` command (`show|clear|off|on|reload|pending|ask on|off|forget <name|all|projects>|<phase>|model=<alias|id> effort=<level>|switch on|off|verbose on|off`). Optional per-machine config `~/.claude/model-router.json`, where `"enabled": false` turns it off on that machine. The spinner suffix and the status line show the route in force. It loads in every session through the tracked symlink `skills/model-router` (`model-router@skills-dir`). `make doctor` gains a Mods section; suite `make test suite=lib/tests/mods.test.sh`. Known limits: a main-loop switch (a `/model` hand pick excepted) runs only while the cold read it costs (the context minus what the target model's prompt cache holds) fits `upgradeMaxTokens` (200000) or `downgradeMaxTokens` (120000), and a downgrade also needs `mainModelSwitch` (on by default, off on any non-boolean value); the hooks send full model ids, so the `models` table has to follow new versions.
|
||||
- **model-router first-use confirmation**: `mods/model-router/routing.json` (tracked) is the single source of the phase table and of every skill and agent row, and keeps the decisions: `confirmed`, `changed` (`from`/`to`), `projects` exceptions keyed by the origin remote reduced to `host/path` (credentials and local paths never stored), and `ask`. The first use of a rowed typed skill, a rowed agent spawn or a main-loop phase declared through the `route` tool opens a dialog with context: the skill's description (first sentence of its `SKILL.md` frontmatter) or the agent's, the phase with its `about` line (a new field on each of the 12 phases) and the model id and effort the next step really runs on. A row offers Later, Keep or Change; a main-loop phase Later or Keep. Change asks the model (fable, opus, sonnet, haiku with their tier), then the effort among those the phases of that model use (skipped when there is only one), then Everywhere or This project only; the pair maps to an existing phase (rows stay phase names, the same phase counts as Keep, a pair no phase offers is added by hand as a new phase). A skill-row change toasts the model and effort it now runs on, with the `/route switch on` hint when the main loop holds back a downgrade; a free-text answer counts as Later. One dialog at a time, never in headless (`-p`) runs or inside a sub-agent. Only a dialog answer, `/route ask on|off` or `/route forget` (which takes decisions back; a changed row returns to its shipped phase, the frontmatter floors stay yours to realign) writes the file (serialized, 64 KiB cap, never created when absent); each write asks you to commit it from the config repo. `/route pending` lists unconfirmed rows and phases. Layers: routing.json < `~/.claude/model-router.json` (its `ask` wins); a project's `.claude/model-router.json` is never read. Tests: `mods/model-router/hooks/register.test.ts`.
|
||||
@@ -20,6 +20,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
||||
- **Project path rules (CLAUDE.md split)**: `lib/project-rules.sh` (`check`, `matches`, `sections`, `extract`, `emit`, optional `-C <dir>`) is the glob oracle for `.claude/rules/<name>.md` rules, one-line `paths:` frontmatter, loaded on Read of a matching file; suite `lib/tests/project-rules.test.sh`. `/onboard split` classifies an existing project CLAUDE.md section by section behind a gate and moves the path-bound ones into rules on a `chore/claude-md-split` branch. `extract` also moves a `###` subsection (heading passed as `'### <title>'`; a bare heading stays `##`), which ends at the next heading of level 3 or less outside a fence, and `sections --depth 3` lists each `##` section's subsections with their sizes, so `/onboard split` can move a path-bound subsection out of an always-on parent (one `### <title>` row; a row's parent is never itself a move row). `extract` refuses an absolute `<out>`, one with a `..` part, or one that already exists (a dangling symlink included), with rc 2 and the reason on stderr, and leaves the source CLAUDE.md untouched when the rule directory or file cannot be written. `/onboard` and `/init-project` emit `docker`, `testing` and `ci` rules from `templates/project-rules/` when their globs match. This repo's CLAUDE.md now keeps its header, Health Stack and a pointer; four sections load as path rules.
|
||||
- **InstructionsLoaded logger**: `hooks/instructions-loaded.sh`, wired in `settings.json`, appends one JSON line per instruction file loaded to `~/.claude/logs/instructions-loaded.jsonl` (rotated above 5 MB), the proof that a path rule loaded.
|
||||
- **Memory registries v2, single writer**: `lib/memory.sh` is the one writer and reader of the `.claude/memory/` registries (every verb takes an optional leading `-C <dir>`): `add <kind> --title … --body-file … [--status …] [--supersedes <ID>]` appends an entry with the next ID from the headings and prints only the new ID; `status <ID> <text>` appends a dated `**Status (<date>)**:` line; `journal <line>` appends under today's `## YYYY-MM-DD`; `index [<kind>]` prints ID, date, title and status from headings and bodies; `check [--staged]` verifies heading shape, unique IDs, no Index and no open fence (a v1 file is named, never failed); `upgrade` migrates v1 to v2 (Index-only dates and statuses become body lines, `format: 2` added, `## Index` removed, every v1 heading dialect becomes `## ID — title (date)`), after an oracle on IDs, check and blocker verdicts, else rc 2 with the file untouched (a duplicate ID or a non-table Index is refused). Writes run under a lock in the git common dir, on a verified backup restored on failure or signal. `templates/memory/` ships v2 templates; the session banner adds `registry v1: N file(s) (memory.sh check)` while a project registry is v1. Suite `lib/tests/memory.test.sh`.
|
||||
- **Architecture defaults carrier**: `lib/architecture-defaults.md`, read before proposing a stack (new project, scaffolding, stack brainstorm, whole-project rewrite): public sites never SPA, Rust by default, web APIs versioned. Path rules `rules/supabase.md` and `rules/cloud-functions.md` hold the full Supabase and cloud-function domains. Suites `lib/tests/user-rules.test.sh` and `lib/tests/doctor-automem.test.sh`.
|
||||
|
||||
### Changed
|
||||
- Registries are written only through `lib/memory.sh`, never by Edit (`CLAUDE.global.md`, Memory registries); every CAPITALIZE step (`/feat`, `/bugfix`, `/hotfix`, `/ship-feature`, `/capitalize`, `/init-project`, `/onboard`, `commit-changer`) writes through `lib/capitalize-commit.md` § WRITE.
|
||||
@@ -41,8 +42,11 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
||||
- `/tour`: each summary row says `on origin` or `local only` with the `! git -C "<project>" push -u origin <branch>` to run. The tour never pushes or retries.
|
||||
- model-router keyword prompt rules (`plan|design|architecture…`, `why|review|audit…`), the `ultrathink` floor and the derived `orchestrate` route of a main Agent dispatch set the turn's effort only, never a model: they no longer lift main above the session model, and a held best-tier run keeps its model. Fable on main comes only from a skill row, the `route` tool, a typed `/route` or a `/model` hand pick (BDR-123). Tests: `mods/model-router/hooks/register.test.ts`.
|
||||
- `.gitignore` and `templates/gitignore/standard.gitignore` un-ignore `.claude/rules/` (`!.claude/rules/` after `.claude/*`); `lib/gitflow-test.sh` asserts the socle line.
|
||||
- Context diet (BDR-125 phase 1): `CLAUDE.global.md` keeps one always-on line for the architecture defaults and points to `lib/architecture-defaults.md`. Design work moves to `rules/web-building.md` § "Design work — full toolchain", and `hooks/design-toolchain-reminder.sh` now tells the model to Read it and no longer fires on `<agent-message` hand-backs. API versioning moves to `rules/rest-api.md`. Graphify usage prints from `hooks/session-start.sh` only where `graphify-out/graph.json` exists. `rules/secure-by-default.md` keeps one line each for Supabase and cloud functions, telling to Read the path rule before writing a new file. Agent descriptions are 200 characters or fewer. Own gain about 2.8k tokens of always-on context (measured `/context` 30.5k to 26.2k).
|
||||
- `settings.json` sets `"autoMemoryEnabled": false`. `make doctor` gains an Auto memory section (the setting, plus leftover files under `~/.claude/projects/*/memory/`) and checks the `~/.claude/rules` symlink (8 links). The session-start health check includes `rules`.
|
||||
|
||||
### Removed
|
||||
- `rules/default-language.md`: its content is `lib/architecture-defaults.md` § Default language.
|
||||
- The five `effort-low` … `effort-max` skills, `lib/effort-pins.txt`, `lib/effort-pins.sh` and `lib/model-check.sh`, with their tests and the effort-pin re-apply steps of `install-plugins.sh` and `update-all.sh`. The model-router rows replace them. A typed `/effort-<level>` no longer exists: use `ultrathink` or `/route effort=max`. Breaking: the next release is 3.0.0.
|
||||
|
||||
### Fixed
|
||||
|
||||
+12
-56
@@ -140,30 +140,10 @@ their CAPITALIZE step. Session close (`/close` = `/capitalize --ritual`):
|
||||
what was decided → decisions, learned → learnings, blocked → blockers.
|
||||
|
||||
# Architecture decisions
|
||||
Override default framework/tooling choices at project creation, scaffolding,
|
||||
brainstorming.
|
||||
|
||||
## Public websites — never SPA
|
||||
A public site meant to be indexed (landing, portfolio, blog, e-commerce,
|
||||
docs) is never a pure SPA (CRA, Vite React, Vue SPA): the empty HTML shell
|
||||
hides content from search and AI engines, SEO and GEO destroyed.
|
||||
- **Astro** by default for informational sites: static HTML at build, zero
|
||||
JS by default, React/Vue/Svelte islands for interactive parts.
|
||||
- **Next.js** when dynamic SSR is needed (personalized content, server-side
|
||||
auth, API routes, hybrid app).
|
||||
- **React SPA** only for what needs no indexing: admin panels, dashboards,
|
||||
auth-gated apps, internal tools. Mixed project: Astro/Next for public,
|
||||
React island (`client:only`) for admin.
|
||||
- At brainstorming (`/init-project`, `/ship-feature` STEP 1), public site
|
||||
and no framework named → propose Astro, explain why not SPA. Never
|
||||
silently pick React CRA.
|
||||
|
||||
## Web APIs — always versioned
|
||||
Every endpoint versioned from day one: `/api/v1/...`, no bare `/api/`; the
|
||||
router mirrors it (`api/v1/routes/`). Breaking change → `v2`, the old
|
||||
version keeps working and clients migrate at their pace; non-breaking
|
||||
additions → current version. Each version is a self-contained contract,
|
||||
never bent to match a newer one.
|
||||
New project, scaffolding, stack brainstorm or whole-project rewrite: Rust
|
||||
by default, a public site is never a SPA (Astro; Next.js when SSR is
|
||||
needed), every web API versioned `/api/v1/` from day one. Read
|
||||
`~/.claude/lib/architecture-defaults.md` before proposing a stack.
|
||||
|
||||
## Version control — gitflow (universal)
|
||||
Every git action follows gitflow, inside a skill or for an ad-hoc commit.
|
||||
@@ -277,7 +257,8 @@ cryptic names.
|
||||
- Docs post-ship → document-release (doc if gstack off); stale-doc audit → doc
|
||||
- Grouped all-axes sweep ("tir groupé", fix + loop until clean) → tour
|
||||
- Open-work inventory / "queue empty?" / stale TODO vs git → reconcile
|
||||
- Design / UI (build, system, audit, polish) → "Design work" below
|
||||
- Design / UI (build, system, audit, polish) → Read
|
||||
`~/.claude/rules/web-building.md` § "Design work" first
|
||||
- Architecture review → plan-eng-review
|
||||
- Before /clear or /compact → capitalize; end-of-session ritual → close
|
||||
- superpowers skills are vendored, called by bare name; an upstream
|
||||
@@ -293,41 +274,16 @@ cryptic names.
|
||||
enable higgsfield`, then Read the skill under `~/.claude/skills/`;
|
||||
`higgsfield generate cost` before a paid run. Landing page "with
|
||||
Higgsfield", named ask → `enable higgsfield-websites`: an aid inside
|
||||
Design work and the site rules, never `website create|deploy|publish`.
|
||||
the Design work rules (`rules/web-building.md`), never
|
||||
`website create|deploy|publish`.
|
||||
gstack OFF → its skills (investigate, qa, review, health, retro,
|
||||
office-hours…) are gone: use the fallback above, else say so.
|
||||
|
||||
## Design work — full toolchain (tiered by scope)
|
||||
Trigger = UI work: editing a component/style file (.tsx/.vue/.svelte/.css…)
|
||||
or a design/UI request, not the word "design" alone. Single source for
|
||||
design routing; the design-toolchain hook reinforces it.
|
||||
- Trivial (≤2 files, one cosmetic value) → /hotfix, no toolchain.
|
||||
- Build UI (component, page, redesign) → impeccable (build path: init,
|
||||
shape, new-work, craft floor, fresh finish reviewer) + ui-ux-pro-max +
|
||||
21st-ui-build (catalog + generation) + emil-design-eng (polish) +
|
||||
design-motion-principles (motion) + design-html (static) + site-motion.
|
||||
Floor: `impeccable detect <files>` (61 rules, exit 2). frontend-design
|
||||
only for a one-off visual with no project context, not beside impeccable.
|
||||
- Design system / brand → design-consultation first, then the build tools.
|
||||
- Review / audit → design-review + emil-design-eng + design-motion-principles
|
||||
+ /impeccable audit|critique + `impeccable detect` floor.
|
||||
- The vendored stack members route to `reflect` (high) through their
|
||||
model-router rows (`mods/model-router`); the last rowed skill loaded
|
||||
wins and an unrowed member (plugin, gstack) changes nothing.
|
||||
Scope doubt → ask or default to Build, never silently skip. Gate: light
|
||||
skills run `~/.claude/lib/design-gate.md`, orchestrators plugin-check. 21st =
|
||||
CLI (`npm i -g @21st-dev/cli`, `21st login`), no MCP, no key; search free,
|
||||
`21st get`/`generate` metered → generation, not micro-tweaks. 21st-ai /
|
||||
ui-explore / ui-review are `max`-profile only.
|
||||
|
||||
## graphify
|
||||
|
||||
Threshold: graphify from 200 tracked code files, never below (banner line
|
||||
`graphify? N code files ≥ 200, no graph` informs, the user decides; never
|
||||
build or `graphify claude install` without that go). ALL rules below apply
|
||||
only if `graphify-out/graph.json` exists — else read files directly.
|
||||
- Codebase-wide question → `graphify query`; relationships → `path A B`;
|
||||
concept → `explain`. Scoped subgraph beats raw grep.
|
||||
- Known file / small task → read directly, no graphify.
|
||||
- `wiki/index.md` → broad-nav entry; `GRAPH_REPORT.md` → whole-architecture.
|
||||
- After editing code → `graphify update .` (AST-only, free).
|
||||
build or `graphify claude install` without that go). With a graph
|
||||
(`graphify-out/graph.json`): `graphify query` before raw grep on
|
||||
codebase-wide questions, `graphify update .` after code edits; the session
|
||||
banner prints the rest.
|
||||
@@ -203,3 +203,7 @@ make doctor
|
||||
A v2 registry is the same `.claude/memory/<name>.md` file, versioned and pushed with the code, with `format: 2` in its frontmatter and no `## Index`. The session banner line `registry v1: N file(s) (memory.sh check)` flags a project still on v1. v1 stays readable and writable (lenient), and the `check --staged` chokepoint skips it.
|
||||
|
||||
To migrate, run `bash ~/.claude/lib/memory.sh -C <project> upgrade` on a clean `.claude/memory`, then commit through `/commit-change` when headings were rewritten (memory-commit refuses heading rewrites by design). `upgrade` refuses a registry with duplicate IDs or a non-table Index and leaves the file untouched: a human renumbers or converts first.
|
||||
|
||||
## Auto memory off (2026-10-29)
|
||||
|
||||
`settings.json` now sets `"autoMemoryEnabled": false`, so Claude Code no longer loads `~/.claude/projects/<slug>/memory/`. Anything left there is knowledge no session reads. `make doctor` (section "Auto memory") counts the project dirs that still hold files. For each one, move what is worth keeping into that project's registries with `bash ~/.claude/lib/memory.sh -C <project> add <kind> --title … --body-file …`, then delete the leftover dir by hand.
|
||||
@@ -491,7 +491,7 @@ make profile-reset # go to the default profile (full)
|
||||
make new-skill name=myskill # scaffold agent + skill files
|
||||
```
|
||||
|
||||
`doctor.sh` checks: symlinks, GStack submodule, vendored skills (curl-pinned externals in `plugins.lock.json` + `link.sh`'s `EXTERNAL_SKILLS`, per the active profile), Playwright browser cache, prerequisites (git, Node, Cargo, Python, Claude Code), plugins, permissions, token budget, config consistency, git hooks (global core.hooksPath + generated githooks/), mods (loading link and `@skills-dir` state), scratchpad (TMPDIR quota), Higgsfield CLI and session, seo-data layer.
|
||||
`doctor.sh` checks: symlinks, GStack submodule, vendored skills (curl-pinned externals in `plugins.lock.json` + `link.sh`'s `EXTERNAL_SKILLS`, per the active profile), Playwright browser cache, prerequisites (git, Node, Cargo, Python, Claude Code), plugins, permissions, token budget, config consistency, git hooks (global core.hooksPath + generated githooks/), mods (loading link and `@skills-dir` state), scratchpad (TMPDIR quota), Higgsfield CLI and session, seo-data layer, auto memory (`autoMemoryEnabled` false in `settings.json`, leftover files under `~/.claude/projects/*/memory/`).
|
||||
|
||||
---
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: bugfixer
|
||||
description: Bug-fix EXECUTOR — dispatched by /bugfix (or /guardrails and /a11y for accepted fixes) with a closed DIAGNOSIS + FIX PLAN + contract. Applies the fix and a regression test, runs the suite, reports. No investigation, no questions, no commit.
|
||||
description: Bug-fix EXECUTOR dispatched by /bugfix (or /guardrails, /a11y) with a closed DIAGNOSIS + FIX PLAN + contract. Applies the fix and a regression test, runs the suite. No investigation, no commit.
|
||||
tools: Read, Edit, Write, Bash, Grep, Glob
|
||||
model: sonnet
|
||||
effort: medium
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: client-handover-writer
|
||||
description: Final ship-and-handover orchestrator — called by /client-handover. Runs the audit/fix/gate pipeline (SEO+GEO+HARDEN to ≥17/20, live VALIDATE) inline on the big session model with fable-pinned skill-runner children, then delegates the client deliverable to the two-mode handover-doc-writer (synthesize opus / render sonnet — BDR-077).
|
||||
description: Final ship-and-handover orchestrator called by /client-handover. Audit/fix/gate pipeline (SEO+GEO+HARDEN to ≥17/20, live VALIDATE), then the client deliverable via handover-doc-writer.
|
||||
tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch, AskUserQuestion, Agent
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: code-cleaner
|
||||
description: Cleanup EXECUTOR (PHASE 2) — dispatched by /code-clean with an APPROVED scope. Deletes approved dead code, hands style/structural items to the refactorer, re-audits. Zero behavior change. No audit, no questions, no commit.
|
||||
description: Cleanup EXECUTOR (PHASE 2) dispatched by /code-clean with an APPROVED scope. Deletes approved dead code, hands style items to the refactorer, re-audits. Zero behavior change, no commit.
|
||||
tools: Read, Edit, Write, Bash, Grep, Glob
|
||||
model: sonnet
|
||||
effort: medium
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: doc-syncer
|
||||
description: 'Two-mode public-doc sync agent — MODE: audit (dispatched model="opus" — drift detection, semantic analysis, drafts, PATCH PLAN, read-only) and MODE: patch (sonnet pin — applies the APPROVED plan, oracle-checked, emits CHANGE SUMMARY + PATCHED_FILES). The validation gate lives in the DISPATCHER (BDR-077). Convention-aware (Diátaxis, Keep a Changelog); never touches .claude/.'
|
||||
description: 'Two-mode public-doc sync agent. MODE: audit (opus, read-only: drift, drafts, PATCH PLAN); MODE: patch (sonnet: applies the approved plan, emits PATCHED_FILES). Never touches .claude/.'
|
||||
tools: Read, Write, Edit, Bash, Grep, Glob
|
||||
model: sonnet
|
||||
effort: high
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: geo-analyzer
|
||||
description: GEO audit agent for AI search engines — dispatched by /geo and /seo. Audits AI crawlers, llms.txt, entity signals, Schema.org; emits a fix bundle (dispatcher applies), scored report. Classical SEO → seo-analyzer agent.
|
||||
description: GEO audit agent for AI search engines, dispatched by /geo and /seo. AI crawlers, llms.txt, entity signals, Schema.org; emits a fix bundle and a scored report. Classical SEO → seo-analyzer.
|
||||
tools: Read, Edit, Write, Bash, Grep, Glob, WebFetch, WebSearch
|
||||
model: opus
|
||||
effort: xhigh
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: handover-doc-writer
|
||||
description: 'Two-mode deliverable writer — MODE: synthesize (dispatched model="opus" — memory+git clustering, 6-chapter synthesis into a run-scoped draft) and MODE: render (sonnet pin — annexes, precheck, deterministic gates, MD + branded HTML/PDF from the draft). Dispatched twice by client-handover with the resolved PACKAGE. No audits, no questions, no dispatch.'
|
||||
description: 'Two-mode client deliverable writer, dispatched twice by client-handover. MODE: synthesize (opus: memory + git, 6-chapter draft); MODE: render (sonnet: annexes, gates, MD + HTML/PDF).'
|
||||
tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
|
||||
model: sonnet
|
||||
effort: high
|
||||
|
||||
@@ -23,8 +23,8 @@ Gather context. Produce complete PROJECT BRIEF as single source of truth.
|
||||
| Answer vague/ambiguous | One targeted follow-up on that item only | Gap: record it in OPEN DECISIONS with the safest reading, marked `(assumed)` — never invent a confident value. Visible / public-name / scope item: one more targeted question instead, never `(assumed)` |
|
||||
| "I don't know / you decide" | Propose ONE concrete default + why, ask yes/no | Take the default, mark `(assumed)`, list in OPEN DECISIONS |
|
||||
| Contradictory answers (e.g. embedded runtime + managed cloud DB) | Name the contradiction, ask which side wins | Put BOTH options in OPEN DECISIONS; do not silently pick one |
|
||||
| Language not stated (new project / from scratch / whole-project rewrite) | Propose Rust + why (`rules/default-language.md`); name the contraindication if another language fits better (browser frontend, mandated platform, missing ecosystem) | Rust, marked `(assumed)`, listed in OPEN DECISIONS |
|
||||
| Project has an API, a database, messaging, cloud functions or a UI | Apply `rules/secure-by-default.md`: note under QUALITY which of the six guardrail domains apply, and whether the accessibility baseline (`rules/a11y.md`) applies, and list each dashboard-only item (spend cap, WAF, budget alert) in OPEN DECISIONS as manual | A domain applies and nothing is planned: list it in OPEN DECISIONS, never drop it silently |
|
||||
| Language not stated (new project / from scratch / whole-project rewrite) | Propose Rust + why (`~/.claude/lib/architecture-defaults.md` § Default language); name the contraindication if another language fits better (browser frontend, mandated platform, missing ecosystem) | Rust, marked `(assumed)`, listed in OPEN DECISIONS |
|
||||
| Project has an API, a database, messaging, cloud functions or a UI | Apply `rules/secure-by-default.md` (Supabase and cloud-function detail: `rules/supabase.md`, `rules/cloud-functions.md`): note under QUALITY which of the six guardrail domains apply, and whether the accessibility baseline (`rules/a11y.md`) applies, and list each dashboard-only item (spend cap, WAF, budget alert) in OPEN DECISIONS as manual | A domain applies and nothing is planned: list it in OPEN DECISIONS, never drop it silently |
|
||||
| Partial answer to the block | Re-ask ONLY the missing items in the follow-up round | Missing fields → `none stated` + OPEN DECISIONS entry |
|
||||
| Feature list balloons (>10) | Keep the 10 the user ranks first as V1 | Overflow goes to OUT OF SCOPE with a `(deferred by budget)` tag |
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: onboarder
|
||||
description: Generate claude-config files (CLAUDE.md, settings.json, .claudeignore, .gitignore safety, .claude/tasks/ + .claude/memory/ + .claude/audits/) for an existing project. Pure config generator — no interview, no audit. Called by /onboard orchestrator.
|
||||
description: Generate claude-config files (CLAUDE.md, settings.json, .claudeignore, .gitignore safety, .claude/{tasks,memory,audits}/) for an existing project. No interview, no audit. Called by /onboard.
|
||||
tools: Read, Write, Edit, Bash, Glob, Grep
|
||||
model: sonnet
|
||||
effort: medium
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: plan-challenger
|
||||
description: Fresh independent plan challenger — reads a PLAN file from disk and adversarially attacks it through ONE assigned lens (correctness | robustness | simplicity), then renders structured findings + a verdict. Report-only, never fixes, never implements. Dispatched fresh; blind to the other lenses.
|
||||
description: Fresh plan challenger. Reads a PLAN file and attacks it through ONE lens (correctness | robustness | simplicity), then renders findings + a verdict. Report-only, blind to the other lenses.
|
||||
tools: Read, Grep, Glob, Bash
|
||||
model: opus
|
||||
effort: xhigh
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: plugin-advisor
|
||||
description: Plugin-fit REASONER — dispatched by lib/plugin-gate.md with a PROBE REPORT (from plugin-probe). Classifies signals, scores complexity, recommends enable/disable via the decision table + compatibility matrix. Report-only.
|
||||
description: Plugin-fit REASONER dispatched by lib/plugin-gate.md with a PROBE REPORT from plugin-probe. Classifies signals, scores complexity, recommends enable/disable. Report-only.
|
||||
tools: Read, Glob, Grep
|
||||
model: opus
|
||||
effort: xhigh
|
||||
|
||||
@@ -16,6 +16,7 @@ Deliver a buildable skeleton: structure + config + empty entry points. No featur
|
||||
2. Approved DESIGN (from brainstorming)
|
||||
3. `~/.claude/templates/project-CLAUDE.md`
|
||||
4. `~/.claude/CLAUDE.md`
|
||||
5. `~/.claude/lib/architecture-defaults.md`
|
||||
|
||||
If any missing → STOP.
|
||||
|
||||
@@ -31,7 +32,7 @@ Store: `DOCKER_RELEVANT = true/false`. If true → Docker is additional, project
|
||||
|
||||
## PHASE 1 — GENERATE CLAUDE.md
|
||||
|
||||
Read `~/.claude/templates/project-CLAUDE.md` and `~/.claude/CLAUDE.md`.
|
||||
Read `~/.claude/templates/project-CLAUDE.md`, `~/.claude/CLAUDE.md` and `~/.claude/lib/architecture-defaults.md`.
|
||||
Fill every section from BRIEF + DESIGN. No placeholders. Irrelevant sections → `N/A — <reason>`.
|
||||
Required: overview, stack+version, build/test/lint/docker commands (exact), folder tree, architecture, conventions, exceptions, deps, workflow.
|
||||
Write to `CLAUDE.md` at project root.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: security-auditor
|
||||
description: 'SAST security gate — runs the pinned semgrep rulesets + the CLAUDE.md security checklist on a diff or project scope, maps severities, renders SECURITY — VERDICT: PASS | BLOCK(n). Blocks HIGH/CRITICAL only, reports the rest. Never fixes code. Fresh dispatch, no iteration history.'
|
||||
description: 'SAST security gate: pinned semgrep rulesets + the CLAUDE.md security checklist on a diff or scope. VERDICT: PASS | BLOCK(n), blocks HIGH/CRITICAL only. Never fixes code. Fresh dispatch.'
|
||||
tools: Read, Grep, Glob, Bash, Write
|
||||
model: opus
|
||||
effort: xhigh
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: seo-analyzer
|
||||
description: 'Classical SEO audit agent (Google, Bing) — dispatched from /seo. Live audit: Core Web Vitals, on-page, technical, local SEO, legal (FR). Emits a fix bundle (dispatcher applies) + scored report. AI/GEO → geo-analyzer agent.'
|
||||
description: 'Classical SEO audit agent (Google, Bing), dispatched from /seo: Core Web Vitals, on-page, technical, local SEO, legal (FR). Emits a fix bundle + scored report. AI/GEO → geo-analyzer.'
|
||||
tools: Read, Edit, Write, Bash, Grep, Glob, WebFetch, WebSearch
|
||||
model: opus
|
||||
effort: xhigh
|
||||
@@ -539,8 +539,8 @@ it is.
|
||||
|
||||
**§0 line, mandatory when not server-rendered:**
|
||||
`Rendering: client-rendered — On-page NOT scored (content absent from served
|
||||
HTML). Global score excludes it. Fix: SSR/SSG (CLAUDE.md: public sites are
|
||||
never SPAs).`
|
||||
HTML). Global score excludes it. Fix: SSR/SSG
|
||||
(lib/architecture-defaults.md: public sites are never SPAs).`
|
||||
|
||||
This is the honest half of the R1/R2 call: we do not render JS (no Playwright,
|
||||
no Chromium), so we do not pretend to see what JS paints. Refusing is the
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: validator-analyzer
|
||||
description: Web standards audit agent — W3C HTML validity (validator.nu), W3C CSS validity (jigsaw.w3.org), WCAG 2.1 accessibility (axe-core, pa11y, WAVE). Dispatched from /web-validate. Produces scored .claude/audits/VALIDATE.md report with concrete diffs for auto-fixable issues and user actions for judgment-required fixes. Complementary to /harden (security), /seo (indexability), /geo (AI extraction).
|
||||
description: Web standards audit agent, dispatched from /web-validate. W3C HTML/CSS validity and WCAG 2.1 (axe-core, pa11y, WAVE); scored .claude/audits/VALIDATE.md with fix diffs and user actions.
|
||||
tools: Read, Edit, Write, Bash, Grep, Glob, WebFetch
|
||||
model: sonnet
|
||||
effort: low
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: verifier
|
||||
description: Fresh independent verifier — reads a CONTRACT file from disk and renders a structured verdict (CONFORME / ECARTS / ERROR) on the implemented diff. Report-only, never fixes. Dispatched fresh at every iteration; receives no iteration history.
|
||||
description: Fresh independent verifier. Reads a CONTRACT file from disk and renders CONFORME / ECARTS / ERROR on the implemented diff. Report-only, never fixes; dispatched with no iteration history.
|
||||
tools: Read, Grep, Glob, Bash
|
||||
model: opus
|
||||
effort: xhigh
|
||||
|
||||
@@ -26,6 +26,8 @@ source "$REPO/lib/gstack-playwright.sh"
|
||||
source "$REPO/lib/doctor-vendored.sh"
|
||||
# shellcheck source=lib/doctor-skills.sh disable=SC1091
|
||||
source "$REPO/lib/doctor-skills.sh"
|
||||
# shellcheck source=lib/doctor-automem.sh disable=SC1091
|
||||
source "$REPO/lib/doctor-automem.sh"
|
||||
# shellcheck source=lib/higgsfield-skills.sh disable=SC1091
|
||||
source "$REPO/lib/higgsfield-skills.sh"
|
||||
|
||||
@@ -37,8 +39,8 @@ echo ""
|
||||
# 1. Core symlinks
|
||||
# ────────────────────────────────────────────────────────────
|
||||
echo "── Symlinks ──"
|
||||
# Expected: CLAUDE.md, settings.json, agents, skills, templates, hooks/session-start.sh
|
||||
_EXPECTED_LINKS=7
|
||||
# Expected: CLAUDE.md, settings.json, agents, skills, templates, lib, rules, hooks/session-start.sh
|
||||
_EXPECTED_LINKS=8
|
||||
_LINK_PASS=0
|
||||
|
||||
check_symlink() {
|
||||
@@ -87,6 +89,7 @@ check_symlink "agents"
|
||||
check_symlink "skills"
|
||||
check_symlink "templates"
|
||||
check_symlink "lib"
|
||||
check_symlink "rules"
|
||||
check_symlink "hooks/session-start.sh"
|
||||
info "Symlinks: ${_LINK_PASS}/${_EXPECTED_LINKS} OK"
|
||||
unset _EXPECTED_LINKS _LINK_PASS
|
||||
@@ -472,6 +475,25 @@ fi
|
||||
unset _sp _sp_fs _sp_opts
|
||||
echo ""
|
||||
|
||||
# ────────────────────────────────────────────────────────────
|
||||
# 5d. Auto memory (BDR-125 phase 1): "autoMemoryEnabled": false, so a file
|
||||
# left under ~/.claude/projects/<slug>/memory/ is never loaded again.
|
||||
# ────────────────────────────────────────────────────────────
|
||||
echo "── Auto memory ──"
|
||||
if jq -e '.autoMemoryEnabled == false' "$REPO/settings.json" >/dev/null 2>&1; then
|
||||
pass "settings.json: autoMemoryEnabled false"
|
||||
else
|
||||
warn "settings.json: autoMemoryEnabled is not false — the auto-memory section loads every session (BDR-125 phase 1)"
|
||||
fi
|
||||
_am=$(automem_leftover_dirs "$HOME/.claude/projects")
|
||||
if [ "$_am" -gt 0 ]; then
|
||||
warn "auto memory: $_am project dir(s) still hold files under ~/.claude/projects/*/memory/ (never loaded) — migrate them to the project registries, then remove them by hand"
|
||||
else
|
||||
pass "auto memory: no leftover file under ~/.claude/projects/*/memory/"
|
||||
fi
|
||||
unset _am
|
||||
echo ""
|
||||
|
||||
# ────────────────────────────────────────────────────────────
|
||||
# 6. Token budget estimate
|
||||
# ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# design-toolchain-reminder.sh
|
||||
#
|
||||
# UserPromptSubmit hook. When the prompt carries a UI/design signal, inject a
|
||||
# reminder to mobilize the full design toolchain (tiered by scope, per CLAUDE.global.md
|
||||
# "Design work — full toolchain"). A UserPromptSubmit hook's stdout is appended
|
||||
# to the model's context, so the cat block below becomes additional guidance.
|
||||
# UserPromptSubmit hook. When the prompt carries a UI/design signal, point the
|
||||
# model at the design toolchain section (tiered by scope). Since BDR-125
|
||||
# phase 1 it lives in rules/web-building.md § "Design work — full toolchain",
|
||||
# not in CLAUDE.global.md: it loads by itself on a UI file Read, and a
|
||||
# chat-only design request needs this pointer. A UserPromptSubmit hook's
|
||||
# stdout is appended to the model's context.
|
||||
#
|
||||
# This is a soft nudge: the tiered rule itself says trivial work uses NO
|
||||
# toolchain, so a false positive (e.g. "API design") costs only a reminder the
|
||||
@@ -25,10 +27,11 @@ prompt="$(printf '%s' "$input" \
|
||||
2>/dev/null || true)"
|
||||
[ -z "$prompt" ] && prompt="$input"
|
||||
|
||||
# Harness-generated turns (subagent/task notifications) are not user
|
||||
# requests — never fire on them (CLAUDE.global.md trigger = a design/UI *request*).
|
||||
# Harness-generated turns (task notifications, sub-agent hand-backs: 857 of
|
||||
# 2,779 logged fires on 2026-10-28) are not user requests — never fire on
|
||||
# them (the Design work trigger = a design/UI *request*).
|
||||
case "$prompt" in
|
||||
'<task-notification>'*) exit 0 ;;
|
||||
'<task-notification>'*|'<agent-message'*) exit 0 ;;
|
||||
esac
|
||||
|
||||
lc="$(printf '%s' "$prompt" | tr '[:upper:]' '[:lower:]')"
|
||||
@@ -72,7 +75,7 @@ if printf '%s' "$lc" | grep -Eq "$pattern"; then
|
||||
"$(printf '%s' "$lc" | grep -oiE "$pattern" | head -1 || true)" \
|
||||
"$(printf '%s' "$prompt" | tr '\n\t' ' ' | cut -c1-100)" >> "$logf" 2>/dev/null || true
|
||||
cat <<'EOF'
|
||||
Design work detected → apply global CLAUDE.md section "Design work — full toolchain" (already in context). Trivial (≤2 files, cosmetic) → /hotfix.
|
||||
Design work detected → Read ~/.claude/rules/web-building.md § "Design work — full toolchain" first. Trivial (≤2 files, cosmetic) → /hotfix.
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
+19
-4
@@ -7,7 +7,7 @@
|
||||
|
||||
# ── Quick health check (filesystem only, no subprocesses) ──
|
||||
BROKEN=()
|
||||
for f in CLAUDE.md settings.json agents skills; do
|
||||
for f in CLAUDE.md settings.json agents skills rules; do
|
||||
[ ! -e "$HOME/.claude/$f" ] && BROKEN+=("$f")
|
||||
done
|
||||
|
||||
@@ -254,9 +254,9 @@ if [ -n "$GRAPHIFY_HINT" ]; then
|
||||
printf "│ 🕸️ %-44s│\n" "${GRAPHIFY_HINT:0:44}"
|
||||
printf "│ %-40s│\n" "→ /graphify (AST, seconds) — you decide"
|
||||
fi
|
||||
# CLAUDE.global.md line-count guard (anti-regression). BDR-062 supersedes
|
||||
# BDR-031's 275 target: 305 is the assumed reality (extraction done at
|
||||
# job1; further compression costs clarity > token gain) — warn past 320.
|
||||
# CLAUDE.global.md line-count guard (anti-regression, BDR-062): warn past
|
||||
# 320. BDR-125 phase 1 moved Design work, the graphify usage and the
|
||||
# architecture defaults to their carriers.
|
||||
if [ -n "$REPO_DIR" ] && [ -f "$REPO_DIR/CLAUDE.global.md" ]; then
|
||||
_claude_lines=$(wc -l < "$REPO_DIR/CLAUDE.global.md")
|
||||
if [ "$_claude_lines" -gt 320 ]; then
|
||||
@@ -293,5 +293,20 @@ echo "│ 💡 /plugin-check before starting a new project │"
|
||||
echo "│ 🩺 make doctor full diagnostic │"
|
||||
echo "└───────────────────────────────────────────────────┘"
|
||||
[ -n "$EFFORT_WARN" ] && printf '%s\n' "$EFFORT_WARN"
|
||||
# graphify usage (BDR-125 phase 1): the rules left CLAUDE.global.md, which
|
||||
# keeps the 200-file threshold and a one-line reminder; they print where a
|
||||
# graph exists.
|
||||
_gx_root=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
if [ -n "$_gx_root" ] && [ -f "$_gx_root/graphify-out/graph.json" ]; then
|
||||
cat <<'EOF'
|
||||
graphify (graphify-out/graph.json present):
|
||||
- Codebase-wide question → `graphify query`; relationships → `path A B`;
|
||||
concept → `explain`. Scoped subgraph beats raw grep.
|
||||
- Known file / small task → read directly, no graphify.
|
||||
- `wiki/index.md` → broad-nav entry; `GRAPH_REPORT.md` → whole-architecture.
|
||||
- After editing code → `graphify update .` (AST-only, free).
|
||||
EOF
|
||||
fi
|
||||
unset _gx_root
|
||||
echo ""
|
||||
unset TOKEN_WARN
|
||||
@@ -0,0 +1,49 @@
|
||||
# Architecture defaults — read before proposing a stack
|
||||
|
||||
Read at project creation, scaffolding, a stack brainstorm or a whole-project
|
||||
rewrite (BDR-125 phase 1). The three defaults are named always-on in
|
||||
`~/.claude/CLAUDE.md` § "Architecture decisions"; the detail lives here.
|
||||
|
||||
## Public websites — never SPA
|
||||
A public site meant to be indexed (landing, portfolio, blog, e-commerce,
|
||||
docs) is never a pure SPA (CRA, Vite React, Vue SPA): the empty HTML shell
|
||||
hides content from search and AI engines, SEO and GEO destroyed.
|
||||
- **Astro** by default for informational sites: static HTML at build, zero
|
||||
JS by default, React/Vue/Svelte islands for interactive parts.
|
||||
- **Next.js** when dynamic SSR is needed (personalized content, server-side
|
||||
auth, API routes, hybrid app).
|
||||
- **React SPA** only for what needs no indexing: admin panels, dashboards,
|
||||
auth-gated apps, internal tools. Mixed project: Astro/Next for public,
|
||||
React island (`client:only`) for admin.
|
||||
- At brainstorming (`/init-project`, `/ship-feature` STEP 1), public site
|
||||
and no framework named → propose Astro, explain why not SPA. Never
|
||||
silently pick React CRA.
|
||||
|
||||
## Default language — Rust
|
||||
|
||||
Scope: a new project, a project from scratch, or a whole-project
|
||||
refactor or rewrite the user asks for. Not a module refactor or a feature
|
||||
inside an existing codebase: that keeps the codebase's language.
|
||||
|
||||
Rust is the default. Two candidates equal on features, security,
|
||||
performance, reliability and ease of use or maintenance → Rust wins.
|
||||
Where Rust can do the job, Rust does it.
|
||||
|
||||
Another language needs a demonstrated gain on one of those axes, stated
|
||||
at the choice: a browser frontend (TypeScript, Astro per the web rules),
|
||||
a platform that mandates its language (Swift, Kotlin), an ecosystem Rust
|
||||
lacks (ML research → Python), a throwaway script where Rust's build
|
||||
cycle costs more than it returns. "Rust is slower to write" alone is not
|
||||
a gain.
|
||||
|
||||
At brainstorming (`/init-project`, `/ship-feature` STEP 1, `/refactor`
|
||||
of a whole project): language not named → propose Rust, name the
|
||||
contraindication if you pick something else. Never silently default to
|
||||
Python, Node or Go. Mixed project: Rust for everything server-side,
|
||||
CLI, systems and tooling; the exception stays scoped to the part that
|
||||
earned it.
|
||||
|
||||
## Web APIs — always versioned
|
||||
Every endpoint `/api/v1/...` from day one, the router mirrors it
|
||||
(`api/v1/routes/`); breaking change → `v2`, the old version keeps working.
|
||||
Full rule: `~/.claude/rules/rest-api.md` § Versioning (loads on API files).
|
||||
+3
-2
@@ -45,8 +45,9 @@ design-review, design-consultation, the `21st` CLI and `21st-ui-build` — the
|
||||
canary for the whole 21st skill pack). The profile also bundles
|
||||
browser/plan/shotgun tooling and graphify for convenience; those never trip the
|
||||
gate. Motion (`design-motion-principles`) and static-HTML (`design-html`) are
|
||||
already in the core set — checked regardless; their CLAUDE.md "+motion /
|
||||
+static" notes say which tool you'll lean on, not a separate activation step.
|
||||
already in the core set — checked regardless; the Design work section
|
||||
(`rules/web-building.md`) names them as the motion and static tools, not a
|
||||
separate activation step.
|
||||
`site-motion` (personal skill, site-level scroll/page choreography) rides the
|
||||
same Build chain but isn't on the GATE-BLOCK list: it ships with the repo,
|
||||
nothing to install or verify.
|
||||
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# lib/doctor-automem.sh — doctor.sh's auto-memory leftover check
|
||||
#
|
||||
# settings.json sets "autoMemoryEnabled": false (BDR-125 phase 1): Claude
|
||||
# Code no longer reads ~/.claude/projects/<slug>/memory/, so a file left
|
||||
# there is knowledge nobody loads. `automem_leftover_dirs <projects_dir>`
|
||||
# prints how many <slug>/memory dirs hold at least one file and ALWAYS
|
||||
# exits 0 (doctor.sh runs under `set -euo pipefail`; an absent dir is 0).
|
||||
#
|
||||
# No `set -euo pipefail` here: a sourced lib must not change the caller's
|
||||
# shell options.
|
||||
# ============================================================
|
||||
|
||||
# automem_leftover_dirs <projects_dir> — see file header.
|
||||
automem_leftover_dirs() {
|
||||
local d n=0
|
||||
for d in "$1"/*/memory; do
|
||||
[ -d "$d" ] || continue
|
||||
if [ -n "$(find "$d" -type f -print -quit 2>/dev/null)" ]; then
|
||||
n=$((n + 1))
|
||||
fi
|
||||
done
|
||||
echo "$n"
|
||||
}
|
||||
@@ -55,7 +55,7 @@ API backend Node.js pure (Express / Fastify / Koa / Hapi / NestJS), sans fronten
|
||||
- **UI/UX** : N/A
|
||||
|
||||
## Typical pain points
|
||||
- Pas de versioning API (/api/v1/) — flag CLAUDE.md : "Web APIs — always versioned"
|
||||
- Pas de versioning API (/api/v1/) — flag `rules/rest-api.md` § Versioning
|
||||
- Validation input absente (pas de Zod/Joi/class-validator)
|
||||
- SQL injections (string concat dans queries brutes)
|
||||
- Auth faible (pas de hash password, ou MD5/SHA1)
|
||||
|
||||
@@ -19,8 +19,12 @@
|
||||
# no brace expansion: one glob per extension; a symlinked dir matches
|
||||
# when the glob names it, globstar never descends into a symlink met
|
||||
# under `**`;
|
||||
# dotglob makes `*` match dotfiles, which the engine's matcher skips: a
|
||||
# glob that only hits hidden paths passes here but never loads),
|
||||
# dotglob makes `*` match dotfiles; the engine reaches hidden dirs too. Its
|
||||
# matcher looks gitignore-style (InstructionsLoaded log, 2026-10-26:
|
||||
# `paths: ["rules/**"]` logged as `globs: ["rules"]` and loaded on a Read
|
||||
# of `.claude/rules/*.md`): a trailing `/**` dropped, a pattern without an
|
||||
# inner `/` matching at any depth. A glob can thus load where this check
|
||||
# does not look; the load proof is the logged session, not this check),
|
||||
# dependency dirs excluded (unless the glob names one: `vendor/**` is a
|
||||
# valid rule): the engine matches the path the model reads,
|
||||
# tracked or not; a typo matches nothing either way. A frontmatter line
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
# lib/tests/design-toolchain-reminder.test.sh
|
||||
set -u
|
||||
H="$(cd "$(dirname "$0")/../.." && pwd)/hooks/design-toolchain-reminder.sh"
|
||||
# Every hook call runs under a throwaway HOME (the fire log is
|
||||
# $HOME/.claude/logs/design-toolchain-fires.log): the suite never writes the
|
||||
# real one (1,770 of 2,779 logged fires were this suite's prompts, 2026-10-28).
|
||||
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
||||
export HOME="$T"
|
||||
LINE='Design work detected → Read ~/.claude/rules/web-building.md § "Design work — full toolchain" first. Trivial (≤2 files, cosmetic) → /hotfix.'
|
||||
pass=0; fail=0
|
||||
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
||||
@@ -23,6 +29,7 @@ check D8-dash-file "$(fire 'ecc_dashboard.py')" quiet
|
||||
check D9-tasknotif "$(fire '<task-notification> <task-id>x</task-id> add css header fonts')" quiet
|
||||
check D10-notif-file "$(fire '<task-notification> design-motion-principles keyframe done')" quiet
|
||||
check D11-bare-ux "$(fire 'changement ux vu de tes trouvailles')" quiet
|
||||
check D12-agent-msg "$(fire '<agent-message from=a1> [Subagent hand-back] add css header fonts')" quiet
|
||||
|
||||
# --- Real UI signals must still FIRE ---
|
||||
check F1-button "$(fire 'add a button')" fire
|
||||
@@ -35,6 +42,12 @@ check F7-admin-dash "$(fire 'admin dashboard screen')" fire
|
||||
check F8-animation "$(fire 'add an animation')" fire
|
||||
check F9-designsys "$(fire 'our design system')" fire
|
||||
check F10-bare-ui "$(fire 'revois l'\''ui du panneau admin')" fire
|
||||
check F11-pasted "$(fire '<pasted_content> add a button')" fire
|
||||
|
||||
# --- The one-liner is a contract (LRN-104): exact text ---
|
||||
check O1-exact-line "$(printf '{"prompt":"add a button"}' | bash "$H")" "$LINE"
|
||||
# the fires above landed in the throwaway HOME, positively (not a global count)
|
||||
check G1-fires-in-temp-home "$([ -s "$T/.claude/logs/design-toolchain-fires.log" ] && echo yes)" yes
|
||||
|
||||
# --- Fire is logged (time + token + excerpt) ---
|
||||
tmp="$(mktemp -d)"
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib/tests/doctor-automem.test.sh — lib/doctor-automem.sh's
|
||||
# automem_leftover_dirs(): absent dir, empty memory dirs, a file, a nested
|
||||
# file, an empty subdir only, rc 0 under errexit (doctor.sh runs under
|
||||
# `set -euo pipefail`) — BDR-125 phase 1.
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
LIB="$ROOT/lib/doctor-automem.sh"
|
||||
# shellcheck source=../doctor-automem.sh disable=SC1091
|
||||
source "$LIB"
|
||||
pass=0; fail=0
|
||||
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
||||
W="$(mktemp -d)"; trap 'rm -rf "$W"' EXIT
|
||||
|
||||
check T1-absent-dir "$(automem_leftover_dirs "$W/nope")" 0
|
||||
mkdir -p "$W/p/-home-a/memory" "$W/p/-home-b/memory"
|
||||
check T2-empty-dirs "$(automem_leftover_dirs "$W/p")" 0
|
||||
echo x > "$W/p/-home-a/memory/MEMORY.md"
|
||||
check T3-one-file "$(automem_leftover_dirs "$W/p")" 1
|
||||
mkdir -p "$W/p/-home-b/memory/sub"; echo y > "$W/p/-home-b/memory/sub/note.md"
|
||||
check T4-nested-file-counts "$(automem_leftover_dirs "$W/p")" 2
|
||||
mkdir -p "$W/p/-home-c/memory/empty-sub"
|
||||
check T5-empty-subdir-silent "$(automem_leftover_dirs "$W/p")" 2
|
||||
check T6-rc0-under-errexit "$(bash -c 'set -euo pipefail; source "$1"; automem_leftover_dirs "$2" >/dev/null; echo "rc$?"' _ "$LIB" "$W/nope")" rc0
|
||||
# doctor.sh calls it on "$HOME/.claude/projects": the same call under a temp HOME
|
||||
mkdir -p "$W/h/.claude/projects/-home-x/memory"; echo z > "$W/h/.claude/projects/-home-x/memory/a.md"
|
||||
check T7-via-temp-home "$(HOME="$W/h" bash -c 'source "$1"; automem_leftover_dirs "$HOME/.claude/projects"' _ "$LIB")" 1
|
||||
|
||||
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
|
||||
@@ -8,6 +8,9 @@
|
||||
# Only citations that NAME the doctrine count: `CLAUDE.md "Section"` and
|
||||
# `CLAUDE.md … § Label`. Bare `section "…"` / `§ X` inside a skill refer to the
|
||||
# skill's own sections and are out of scope.
|
||||
# Since BDR-125 phase 1 doctrine also lives in rules/ and lib/: a
|
||||
# `rules/<f>.md § Label` / `lib/<f>.md § Label` citation resolves against
|
||||
# that file (T4-T6).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
pass=0; fail=0
|
||||
@@ -50,6 +53,35 @@ citers_check() {
|
||||
return $(( n > 99 ? 99 : n ))
|
||||
}
|
||||
|
||||
# _citers_extract_files <file>… → "file:line:target:name" per citation of a
|
||||
# heading in another doctrine file: `rules/<f>.md § Label` or
|
||||
# `lib/<f>.md § Label`, backticks around the path and quotes around the
|
||||
# label allowed. A quoted label runs to its closing quote (`—` included); an
|
||||
# unquoted one ends at the first character that is not a letter, space or
|
||||
# hyphen: quote a label that prose follows. A citation of
|
||||
# `.claude/rules/<f>.md § X` would be read as `rules/<f>.md` (none exist;
|
||||
# ERE has no lookbehind and the portability census bans grep -P).
|
||||
_citers_extract_files() {
|
||||
/usr/bin/grep -nHoE '(rules|lib)/[a-z0-9-]+\.md`? § ?"[^"]{2,60}"' "$@" 2>/dev/null \
|
||||
| sed -E 's/^([^:]+:[0-9]+):(.*\.md)`? § ?"([^"]+)"$/\1:\2:\3/'
|
||||
/usr/bin/grep -nHoE '(rules|lib)/[a-z0-9-]+\.md`? § ?[A-Z][A-Za-z][A-Za-z -]{1,40}' "$@" 2>/dev/null \
|
||||
| sed -E 's/^([^:]+:[0-9]+):(.*\.md)`? § ?(.*)$/\1:\2:\3/; s/[[:space:]]+$//'
|
||||
}
|
||||
|
||||
# citers_check_files <root> <file>… → DANGLING lines; rc = their count (capped 99)
|
||||
citers_check_files() {
|
||||
local root="$1" line file lno target name n=0; shift
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
file="${line%%:*}"; lno="$(printf '%s' "$line" | cut -d: -f2)"
|
||||
target="$(printf '%s' "$line" | cut -d: -f3)"; name="${line#*:*:*:}"
|
||||
if [ ! -f "$root/$target" ] || ! _citers_resolve "$root/$target" "$name"; then
|
||||
echo "DANGLING: $file:$lno → $target § \"$name\""; n=$((n+1))
|
||||
fi
|
||||
done < <(_citers_extract_files "$@")
|
||||
return $(( n > 99 ? 99 : n ))
|
||||
}
|
||||
|
||||
# ── flip-test: a synthetic dangling citation must be caught ──────────────────
|
||||
FIX="$(mktemp -d)"; trap 'rm -rf "$FIX"' EXIT
|
||||
# shellcheck disable=SC2016 # literal backticks in the fixture heading
|
||||
@@ -65,6 +97,22 @@ out=$(citers_check "$FIX/doctrine.md" "$FIX/bad.md"); rc=$?
|
||||
check T2-dangling-section-and-label-caught "$rc" 2
|
||||
check T2b-names-the-culprit "$(printf '%s\n' "$out" | grep -c 'bad.md:1')" 2
|
||||
check T2c-label-named "$(printf '%s\n' "$out" | grep -c '"Language"')" 1
|
||||
mkdir -p "$FIX/rules" "$FIX/lib"
|
||||
printf '## Versioning\nx\n' > "$FIX/rules/api.md"
|
||||
printf '## WRITE (before the commit)\n' > "$FIX/lib/cc.md"
|
||||
# shellcheck disable=SC2016 # literal backticks in the fixture
|
||||
printf 'ok: see `rules/api.md` § Versioning, and lib/cc.md § WRITE (x)\n' > "$FIX/fgood.md"
|
||||
printf 'quoted: rules/api.md § "Versioning" first\n' >> "$FIX/fgood.md"
|
||||
printf '## Design work — full toolchain (tiered)\n' > "$FIX/rules/web.md"
|
||||
printf 'dash: rules/web.md § "Design work — full toolchain" first\n' >> "$FIX/fgood.md"
|
||||
printf 'bad: rules/api.md § "Version", rules/none.md § Alpha, lib/cc.md § Read\n' > "$FIX/fbad.md"
|
||||
printf 'dash: rules/web.md § "Design work — full kit" first\n' >> "$FIX/fbad.md"
|
||||
citers_check_files "$FIX" "$FIX/fgood.md" >/dev/null; check T4-file-citations-resolve "$?" 0
|
||||
out=$(citers_check_files "$FIX" "$FIX/fbad.md"); rc=$?
|
||||
check T5-file-dangling-caught "$rc" 4
|
||||
check T5d-quoted-label-whole "$(printf '%s\n' "$out" | grep -c 'full kit')" 1
|
||||
check T5b-missing-file-named "$(printf '%s\n' "$out" | grep -c 'rules/none.md')" 1
|
||||
check T5c-prefix-not-a-heading "$(printf '%s\n' "$out" | grep -c '"Version"')" 1
|
||||
|
||||
# ── real census: the repo's own citers against CLAUDE.global.md ──────────────
|
||||
mapfile -t FILES < <(cd "$ROOT" && find skills agents lib rules hooks -type f \( -name '*.md' -o -name '*.sh' \) \
|
||||
@@ -73,6 +121,23 @@ mapfile -t FILES < <(cd "$ROOT" && find skills agents lib rules hooks -type f \(
|
||||
out=$(cd "$ROOT" && citers_check CLAUDE.global.md "${FILES[@]}"); rc=$?
|
||||
[ -n "$out" ] && printf '%s\n' "$out"
|
||||
check T3-repo-citations-resolve "$rc" 0
|
||||
out=$(cd "$ROOT" && citers_check_files "$ROOT" "${FILES[@]}" CLAUDE.global.md); rc=$?
|
||||
[ -n "$out" ] && printf '%s\n' "$out"
|
||||
check T6-repo-file-citations-resolve "$rc" 0
|
||||
# T7: the real citers bite — the same two files against a copy of
|
||||
# rules/rest-api.md whose heading is renamed (never edit the live rules/)
|
||||
mkdir -p "$FIX/copy/rules"
|
||||
cp "$ROOT/rules/rest-api.md" "$FIX/copy/rules/rest-api.md"
|
||||
(cd "$ROOT" && citers_check_files "$FIX/copy" lib/architecture-defaults.md \
|
||||
lib/project-archetypes/rest-api-node.md) >/dev/null
|
||||
check T7a-real-citers-control "$?" 0
|
||||
sed 's/^## Versioning$/## Version policy/' "$ROOT/rules/rest-api.md" > "$FIX/copy/rules/rest-api.md"
|
||||
(cd "$ROOT" && citers_check_files "$FIX/copy" lib/architecture-defaults.md \
|
||||
lib/project-archetypes/rest-api-node.md) >/dev/null
|
||||
check T7b-real-rename-bites "$?" 2
|
||||
# the hook's pointer is checked whole, not as its "Design work" prefix
|
||||
check T7c-hook-label-whole "$(cd "$ROOT" && _citers_extract_files hooks/design-toolchain-reminder.sh \
|
||||
| grep -c ':rules/web-building.md:Design work — full toolchain$')" 2
|
||||
|
||||
echo "PASS=$pass FAIL=$fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
@@ -210,7 +210,7 @@ has "agents/client-handover-writer.md" 'ROUTING: follow $HOME/.claude/lib/effort
|
||||
# ── (f) doctrine includes ────────────────────────────────────────────────
|
||||
has "lib/model-gate.md" 'mcp__model-router__route'
|
||||
has "lib/effort-shift.md" 'ToolSearch'
|
||||
has "CLAUDE.global.md" 'route to `reflect` (high) through their'
|
||||
has "rules/web-building.md" 'route to `reflect` (high) through their'
|
||||
|
||||
# ── (g) session default and hooks (unchanged locks) ──────────────────────
|
||||
has "settings.json" '"effortLevel": "high"'
|
||||
|
||||
@@ -56,5 +56,21 @@ for i in $(seq 1 300); do echo "# $i" > "$d/doc$i.md"; done
|
||||
git -C "$d" add -A; git -C "$d" commit -q -m docs
|
||||
check T9-non-code-not-counted "$(gate "$d")" silent
|
||||
|
||||
# ── session-start prints the usage rules only where a graph exists
|
||||
# (BDR-125 phase 1: the body left CLAUDE.global.md) ──
|
||||
SS="$(cd "$(dirname "$0")/../.." && pwd)/hooks/session-start.sh"
|
||||
banner() { (cd "$1" && SESSION_START_OFFLINE=1 bash "$SS" </dev/null 2>/dev/null); }
|
||||
d=$(mkrepo ss 1)
|
||||
out=$(banner "$d")
|
||||
check S1-banner-control "$(grep -c 'Claude Code config' <<<"$out")" 1
|
||||
check S1b-no-graph-silent "$(grep -c 'graphify query' <<<"$out")" 0
|
||||
mkdir -p "$d/graphify-out" "$d/app/sub"; echo '{}' > "$d/graphify-out/graph.json"
|
||||
out=$(banner "$d")
|
||||
check S2-graph-prints "$(grep -c 'graphify query' <<<"$out")" 1
|
||||
check S2b-update-rule "$(grep -c 'graphify update \.' <<<"$out")" 1
|
||||
check S3-from-subdir "$(banner "$d/app/sub" | grep -c 'graphify query')" 1
|
||||
out=$(banner "$WORK/plain")
|
||||
check S4-not-a-repo "$(grep -c 'graphify query' <<<"$out")/$(grep -c 'Claude Code config' <<<"$out")" 0/1
|
||||
|
||||
echo "PASS=$pass FAIL=$fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib/tests/user-rules.test.sh — user-scope rules (rules/*.md, deployed as
|
||||
# ~/.claude/rules): every frontmatter parses (one-line JSON `paths:` or no
|
||||
# frontmatter at all) and the always-on set is exactly the two rules chat
|
||||
# needs (BDR-125 phase 1 moved default-language to lib/architecture-defaults.md
|
||||
# and the Supabase / cloud-functions bodies to path rules). Globs are not
|
||||
# matched here: user rules span every stack; the load is proved by an
|
||||
# InstructionsLoaded session (contract context-diet, criterion 15).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
# shellcheck source=../project-rules.sh disable=SC1091
|
||||
source "$ROOT/lib/project-rules.sh"
|
||||
pass=0; fail=0
|
||||
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
||||
|
||||
# rule_kind <file> → path | always | bad
|
||||
rule_kind() {
|
||||
local fm
|
||||
fm=$(_rules_frontmatter "$1") || { echo always; return; }
|
||||
_rules_globs "$fm" >/dev/null
|
||||
case $? in 0) echo path ;; 1) echo always ;; *) echo bad ;; esac
|
||||
}
|
||||
# always_on <dir> → the always-on rule file names, space-joined
|
||||
always_on() {
|
||||
local f out=""
|
||||
for f in "$1"/*.md; do
|
||||
[ "$(rule_kind "$f")" = always ] && out="$out ${f##*/}"
|
||||
done
|
||||
printf '%s\n' "${out# }"
|
||||
}
|
||||
|
||||
# ── flip controls: the checker bites (LRN-096) ──
|
||||
FIX="$(mktemp -d)"; trap 'rm -rf "$FIX"' EXIT
|
||||
printf -- '---\npaths: ["**/*.css"]\n---\n\n# A\n' > "$FIX/a.md"
|
||||
printf '# B, always-on\n' > "$FIX/b.md"
|
||||
printf -- '---\npaths:\n - "**/*.css"\n---\n\n# C\n' > "$FIX/c.md"
|
||||
check F1-path-rule "$(rule_kind "$FIX/a.md")" path
|
||||
check F2-no-frontmatter-always "$(rule_kind "$FIX/b.md")" always
|
||||
check F3-multiline-paths-bad "$(rule_kind "$FIX/c.md")" bad
|
||||
check F4-extra-always-on-seen "$(always_on "$FIX")" "b.md"
|
||||
# the R2 lock itself bites on a dir whose always-on set differs
|
||||
cp "$FIX/b.md" "$FIX/writing-style.md"; cp "$FIX/b.md" "$FIX/secure-by-default.md"
|
||||
check F5-lock-bites "$([ "$(always_on "$FIX")" = "secure-by-default.md writing-style.md" ] && echo match || echo mismatch)" mismatch
|
||||
|
||||
# ── the real rules ──
|
||||
bad=""
|
||||
for f in "$ROOT"/rules/*.md; do
|
||||
[ "$(rule_kind "$f")" = bad ] && bad="$bad ${f##*/}"
|
||||
done
|
||||
check R1-every-frontmatter-parses "${bad# }" ""
|
||||
check R2-always-on-set "$(always_on "$ROOT/rules")" "secure-by-default.md writing-style.md"
|
||||
check R3-moved-rules-path "$(rule_kind "$ROOT/rules/supabase.md")/$(rule_kind "$ROOT/rules/cloud-functions.md")" path/path
|
||||
|
||||
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
paths: ["**/functions/**", "**/serverless.*", "**/firebase.json"]
|
||||
---
|
||||
|
||||
# Cloud functions — secure by default, domain 6
|
||||
|
||||
Path-scoped body of `rules/secure-by-default.md` domain 6 (BDR-125 phase 1);
|
||||
the always-on line there keeps the instance cap and the self-trigger ban.
|
||||
|
||||
- No function re-triggers itself: never write to the resource that fires it,
|
||||
never invoke itself. If unavoidable, guard with an idempotency flag.
|
||||
- Max instances (or reserved concurrency) and a timeout on every function.
|
||||
- Budget alert wired to an automatic stop beyond the budget.
|
||||
@@ -1,23 +0,0 @@
|
||||
# Default language — Rust
|
||||
|
||||
Scope: a new project, a project from scratch, or a whole-project
|
||||
refactor or rewrite the user asks for. Not a module refactor or a feature
|
||||
inside an existing codebase: that keeps the codebase's language.
|
||||
|
||||
Rust is the default. Two candidates equal on features, security,
|
||||
performance, reliability and ease of use or maintenance → Rust wins.
|
||||
Where Rust can do the job, Rust does it.
|
||||
|
||||
Another language needs a demonstrated gain on one of those axes, stated
|
||||
at the choice: a browser frontend (TypeScript, Astro per the web rules),
|
||||
a platform that mandates its language (Swift, Kotlin), an ecosystem Rust
|
||||
lacks (ML research → Python), a throwaway script where Rust's build
|
||||
cycle costs more than it returns. "Rust is slower to write" alone is not
|
||||
a gain.
|
||||
|
||||
At brainstorming (`/init-project`, `/ship-feature` STEP 1, `/refactor`
|
||||
of a whole project): language not named → propose Rust, name the
|
||||
contraindication if you pick something else. Never silently default to
|
||||
Python, Node or Go. Mixed project: Rust for everything server-side,
|
||||
CLI, systems and tooling; the exception stays scoped to the part that
|
||||
earned it.
|
||||
+6
-2
@@ -31,7 +31,7 @@ wait, or 202 + status URL. Retention outlives the longest retry
|
||||
path, dead-letter replay included.
|
||||
|
||||
## Naming
|
||||
Plural nouns for endpoints (`/api/tasks`), no verbs. camelCase query
|
||||
Plural nouns for endpoints (`/api/v1/tasks`), no verbs. camelCase query
|
||||
params and response fields. UPPER_SNAKE enum values. Boolean fields
|
||||
prefixed is/has/can.
|
||||
|
||||
@@ -40,4 +40,8 @@ Every observable behavior — undocumented quirks, error text, timing —
|
||||
becomes a de facto contract once someone depends on it.
|
||||
|
||||
## Versioning
|
||||
CLAUDE.md § Web APIs — always versioned. Not repeated here.
|
||||
Every endpoint versioned from day one: `/api/v1/...`, no bare `/api/`; the
|
||||
router mirrors it (`api/v1/routes/`). Breaking change → `v2`, the old
|
||||
version keeps working and clients migrate at their pace; non-breaking
|
||||
additions → current version. Each version is a self-contained contract,
|
||||
never bent to match a newer one.
|
||||
@@ -39,13 +39,9 @@ never claimed done: write it as a manual step in the project's deploy notes.
|
||||
comments carry no token, hash, key or secret.
|
||||
|
||||
## 4. Supabase
|
||||
- RLS enabled on every table, in the migration that creates it.
|
||||
- Policies limited to the owner: `(select auth.uid())` per operation, role
|
||||
`authenticated`. No `using (true)` on writes, no anon write.
|
||||
- No `service_role` or secret key client-side: not in a bundle, not in a
|
||||
`NEXT_PUBLIC_`, `VITE_` or `PUBLIC_` variable.
|
||||
- Views `security_invoker`. `security definer` functions pin `search_path`
|
||||
and revoke execute from anon. Buckets private by default.
|
||||
- RLS on every table, never a service_role or secret key client-side.
|
||||
Full domain: ~/.claude/rules/supabase.md; Read it before writing a
|
||||
migration, policy or client (a new file's Write loads no path rule).
|
||||
|
||||
## 5. SMS and email
|
||||
- Prior consent recorded per contact: who, when, channel, source, wording.
|
||||
@@ -54,7 +50,6 @@ never claimed done: write it as a manual step in the project's deploy notes.
|
||||
SMS says STOP, and a STOP reply is processed and stored automatically.
|
||||
|
||||
## 6. Cloud functions
|
||||
- No function re-triggers itself: never write to the resource that fires it,
|
||||
never invoke itself. If unavoidable, guard with an idempotency flag.
|
||||
- Max instances (or reserved concurrency) and a timeout on every function.
|
||||
- Budget alert wired to an automatic stop beyond the budget.
|
||||
- Max instances and a timeout on every function, never a self-trigger.
|
||||
Full domain: ~/.claude/rules/cloud-functions.md; Read it before
|
||||
writing a function (a new file's Write loads no path rule).
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
paths: ["**/supabase/**", "**/*supabase*.*"]
|
||||
---
|
||||
|
||||
# Supabase — secure by default, domain 4
|
||||
|
||||
Path-scoped body of `rules/secure-by-default.md` domain 4 (BDR-125 phase 1);
|
||||
the always-on line there keeps RLS and the client-side key ban.
|
||||
|
||||
- RLS enabled on every table, in the migration that creates it.
|
||||
- Policies limited to the owner: `(select auth.uid())` per operation, role
|
||||
`authenticated`. No `using (true)` on writes, no anon write.
|
||||
- No `service_role` or secret key client-side: not in a bundle, not in a
|
||||
`NEXT_PUBLIC_`, `VITE_` or `PUBLIC_` variable.
|
||||
- Views `security_invoker`. `security definer` functions pin `search_path`
|
||||
and revoke execute from anon. Buckets private by default.
|
||||
@@ -43,3 +43,26 @@ compressed images.
|
||||
Report the missing items to the user instead of inventing them. Internal
|
||||
tools and dashboards: only the relevant items apply. Deep audits stay
|
||||
with /seo, /harden, /web-validate.
|
||||
|
||||
## Design work — full toolchain (tiered by scope)
|
||||
Trigger = UI work: editing a component/style file (.tsx/.vue/.svelte/.css…)
|
||||
or a design/UI request, not the word "design" alone. Single source for
|
||||
design routing; the design-toolchain hook reinforces it.
|
||||
- Trivial (≤2 files, one cosmetic value) → /hotfix, no toolchain.
|
||||
- Build UI (component, page, redesign) → impeccable (build path: init,
|
||||
shape, new-work, craft floor, fresh finish reviewer) + ui-ux-pro-max +
|
||||
21st-ui-build (catalog + generation) + emil-design-eng (polish) +
|
||||
design-motion-principles (motion) + design-html (static) + site-motion.
|
||||
Floor: `impeccable detect <files>` (61 rules, exit 2). frontend-design
|
||||
only for a one-off visual with no project context, not beside impeccable.
|
||||
- Design system / brand → design-consultation first, then the build tools.
|
||||
- Review / audit → design-review + emil-design-eng + design-motion-principles
|
||||
+ /impeccable audit|critique + `impeccable detect` floor.
|
||||
- The vendored stack members route to `reflect` (high) through their
|
||||
model-router rows (`mods/model-router`); the last rowed skill loaded
|
||||
wins and an unrowed member (plugin, gstack) changes nothing.
|
||||
Scope doubt → ask or default to Build, never silently skip. Gate: light
|
||||
skills run `~/.claude/lib/design-gate.md`, orchestrators plugin-check. 21st =
|
||||
CLI (`npm i -g @21st-dev/cli`, `21st login`), no MCP, no key; search free,
|
||||
`21st get`/`generate` metered → generation, not micro-tweaks. 21st-ai /
|
||||
ui-explore / ui-review are `max`-profile only.
|
||||
@@ -489,6 +489,7 @@
|
||||
},
|
||||
"feedbackDrafts": "off",
|
||||
"effortLevel": "high",
|
||||
"autoMemoryEnabled": false,
|
||||
"remoteControlAtStartup": true,
|
||||
"inputNeededNotifEnabled": true,
|
||||
"skipAutoPermissionPrompt": true,
|
||||
|
||||
@@ -273,8 +273,9 @@ Then offer to capitalize (per CLAUDE.md): recurring finding patterns →
|
||||
errors, resource leaks (missing trap/close/finally). Improvements only
|
||||
when concrete and local: simplification, dedup against an existing
|
||||
helper, obvious perf.
|
||||
- **conformity** — read project `CLAUDE.md` (+ `~/.claude/CLAUDE.md`)
|
||||
FIRST, then check changed code against those norms. This repo's:
|
||||
- **conformity** — read project `CLAUDE.md` (+ `~/.claude/CLAUDE.md` and
|
||||
`~/.claude/lib/architecture-defaults.md`) FIRST, then check changed code
|
||||
against those norms. This repo's:
|
||||
≤25 logic lines/function, ≤80 chars/line, ≤5 params, ≤5 locals, no
|
||||
global state, intent-not-mechanics comments, explicit naming, versioned
|
||||
APIs (`/api/v1/`), no-SPA-for-public-sites, security defaults. Foreign
|
||||
|
||||
@@ -7,7 +7,8 @@ argument-hint: '[project path] [--domain api,hosting,supabase,messaging,function
|
||||
|
||||
# /guardrails
|
||||
|
||||
Checks a project against `rules/secure-by-default.md`, then fixes what the
|
||||
Checks a project against `rules/secure-by-default.md` (domains 4 and 6 in
|
||||
full: `rules/supabase.md`, `rules/cloud-functions.md`), then fixes what the
|
||||
user accepts and proves each fix. A scanner reads the tree as data and finds
|
||||
what text can prove. This skill judges the hits, covers what text cannot
|
||||
prove, lists what only a dashboard can set and, on request, probes a running
|
||||
|
||||
@@ -71,6 +71,9 @@ Load `$HOME/.claude/agents/analyzer.md`. Analyze BRIEF: existing code, stack con
|
||||
|
||||
## STEP 3 — DESIGN
|
||||
Invoke `brainstorming` (vendored superpowers skill) with BRIEF + ANALYSIS REPORT.
|
||||
Read `~/.claude/lib/architecture-defaults.md` first and pass it as binding
|
||||
context: its defaults (Rust, never a SPA for a public site, `/api/v1/`) hold
|
||||
unless the BRIEF names otherwise.
|
||||
Produce DESIGN: stack+versions, full folder tree, module responsibilities, data flow, interfaces (signatures only), config+tooling, test strategy, resolved decisions, prereqs list.
|
||||
Then run pass B of `$HOME/.claude/lib/contract-interview.md` against the DESIGN
|
||||
(minus what the BRIEF and the brainstorm settled): one batch before STEP 4;
|
||||
@@ -102,7 +105,8 @@ BDR-077 : le design est CLOS au gate #1, le scaffold est de l'exécution,
|
||||
plus jamais inline sur le modèle de session). Pass IN THE PROMPT (LRN-126 —
|
||||
every field the scaffolder consumes crosses the dispatch): BRIEF (verbatim)
|
||||
+ DESIGN (verbatim) + paths `~/.claude/templates/project-CLAUDE.md` +
|
||||
`~/.claude/CLAUDE.md`. A STOP (missing input) comes back as its report —
|
||||
`~/.claude/CLAUDE.md` + `~/.claude/lib/architecture-defaults.md`. A STOP
|
||||
(missing input) comes back as its report —
|
||||
resolve here, re-dispatch. The ~30s liveness pings are THIS loop's job
|
||||
while waiting.
|
||||
Creates: CLAUDE.md, `.claude/settings.json`, `.claudeignore`, `.gitignore`, `.env.example`, empty entry points. NO README, NO features.
|
||||
|
||||
@@ -371,6 +371,10 @@ Attendre la fin. Vérifier que `.onboard-audit/analyze.md` existe et est non vid
|
||||
|
||||
Lire le bloc `audit_stack:` du fichier `~/.claude/lib/project-archetypes/<archetype>.md`.
|
||||
|
||||
Les audits jugent l'architecture contre `~/.claude/lib/architecture-defaults.md`
|
||||
(site public jamais SPA, API `/api/v1/`, Rust par défaut pour une réécriture) :
|
||||
passer ce chemin dans chaque brief d'audit.
|
||||
|
||||
**Mapping audit_stack entry → action :**
|
||||
|
||||
| Entry | Action | Livraison |
|
||||
|
||||
@@ -110,6 +110,10 @@ not the raw request alone:
|
||||
Existing code that bears: <ANALYSIS CONTEXT / KEY COMPONENTS from 0d>.
|
||||
Brainstorm WITHIN these — don't re-explore a direction an in-force BDR rejects or a
|
||||
BLK already closed."
|
||||
When the feature picks a language, a framework or an API shape, Read
|
||||
`~/.claude/lib/architecture-defaults.md` first and add to the in-force
|
||||
constraints the defaults whose Scope applies (an existing codebase keeps its
|
||||
language).
|
||||
Inject ONLY what constrains: the NON-BINDING count does NOT enter the brainstorm input
|
||||
(the injection inherits the OUTPUT filter — detail what binds, drop what doesn't).
|
||||
Consumption = INPUT INJECTION (we can't modify the external skill; we control its input).
|
||||
|
||||
Reference in new issue
Block a user