11 KiB
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]
ACCEPTANCE CRITERIA
- settings.json carries
"autoMemoryEnabled": false. CHECK: jq -e '.autoMemoryEnabled == false' settings.json >/dev/null && echo AUTOMEM-OFF EXPECT: AUTOMEM-OFF EVIDENCE: pending - 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 achore/*branch of that repo, with the text the user approved; no other project's.claude/memory/changes. - 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/rulessymlink and that settings.jsonautoMemoryEnabledis false. - CLAUDE.global.md has no
## Design workheading; rules/web-building.md ends with the section## Design work — full toolchain (tiered by scope), body identical to the CLAUDE.global.md section at develop017a28b(internal pointers excepted, listed in the plan); web-building.mdpaths:unchanged. CHECK: bash .claude/tasks/contracts/c1-design-moved.sh EXPECT: DESIGN-MOVED EVIDENCE: pending - hooks/design-toolchain-reminder.sh prints a one-liner that names
~/.claude/rules/web-building.mdand the heading fragmentfull toolchain, and no longer says "already in context"; its suite asserts the exact new line. - The design hook stays quiet on a prompt starting with
<agent-messageeven when it carries UI tokens (new D-test), and still fires on F1-F10. - 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: pending
- [gated 2026-10-29] amended:
## graphifykeeps the threshold rule plus ONE reminder clause (graphify querybefore raw grep,graphify update .after code edits; sub-agents never see the banner); the full usage body moves as below. Original: CLAUDE.global.md## graphifykeeps 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 holdsgraphify-out/graph.json; a suite proves present-with-graph and absent-without (flip). - 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 websitesand no## Web APIsheading and holds one always-on line naming Rust default, never SPA,/api/v1and the lib path; rules/default-language.md no longer exists. CHECK: bash .claude/tasks/contracts/c1-arch-moved.sh EXPECT: ARCH-MOVED EVIDENCE: pending - 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: pending - rules/rest-api.md
## Versioningcarries the full versioning rule (text of CLAUDE.global.md § Web APIs at017a28b), no "Not repeated here"; lib/project-archetypes/rest-api-node.md cites rules/rest-api.md instead of CLAUDE.md "Web APIs — always versioned". - 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 at017a28b, wording identical; secure-by-default.md keeps the## 4. Supabaseand## 6. Cloud functionsheadings 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: pending - 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-linepaths:fixture and an extra always-on fixture both fail it. - lib/project-rules.sh header comment states the observed engine matching (trailing
/**dropped, a pattern matches at any depth, hidden dirs included, evidence: InstructionsLoadedglobs: ["rules"]on.claude/rules/*.md) instead of "the engine's matcher skips" dotfiles; code behaviour unchanged. - 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_matchfor rules/supabase.md (faunosteo), rules/cloud-functions.md (game, supabase/functions), rules/web-building.md (a UI file); andbash 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). - Every tracked agents/.md
description:(the 4 vendored impeccable- excepted) is ≤ the length settled at the plan gate; agent names, files andmodel:lines unchanged. CHECK: bash .claude/tasks/contracts/c1-agent-desc.sh EXPECT: AGENT-DESC-OK EVIDENCE: pending - 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.
- 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: pending
/contextafter (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.- make test all green and shellcheck clean. CHECK: make test 2>&1 | tail -1 EXPECT: all suites green EVIDENCE: pending
- shellcheck clean on the health stack. CHECK: shellcheck .sh hooks/.sh lib/*.sh && echo SHELLCHECK-CLEAN EXPECT: SHELLCHECK-CLEAN EVIDENCE: pending
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], 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.