diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index 110b66e..83d8076 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -51,6 +51,7 @@ rules: | BLK-029 | 2026-10-08 | Claude Code mods (2.1.294): alias → id resolution for a model set by a hook lags the Agent tool's (`sonnet` → `claude-sonnet-5`, 404); Agent tool schema refuses full ids | upstream | | BLK-030 | 2026-10-15 | model-router kept routing best-tier phases to Fable out of usage credits: each new session + each hold lapse lost a turn to 429 `model_requires_usage_credits`; breaker reactive only | resolved | | BLK-031 | 2026-10-16 | model-router: session starting on Fable w/o credits lost 1st turn + each hold lapse; probe skipped kept cur | resolved | +| BLK-032 | 2026-10-19 | Main loop pinned on Fable in long sessions: session model Fable 1M + downgrade cap 120k + prompt rule `plan` → inline code on Fable xhigh; user routing policy recorded for next /feat | open | --- @@ -329,3 +330,7 @@ rules: - **Solution**: c11cd3b drops `!call.moved` guard: model decision lands on (moved or kept) probed once if table id, unverified, not held. Fail → markDown 'probe', one re-decision → leaveDown → opus, stand-in effort +1. Cost ~1.3 s healthy / ≤8 s dead, 1st decision per process. Test `probe: a session model that never answers leaves for opus on the first step`. - **Status**: resolved. Open: leaveDown follows classifier `wanted` (implement → sonnet), not opus; "context size unknown" likely document attachment → `promptSize` unknown. - **Reference**: [[BLK-030]], [[LRN-218]], contract `.claude/tasks/contracts/2026-10-16-router-probe-session-model-1850.md`. + +## BLK-032 — Main loop pinned on Fable in long sessions: session model Fable 1M + downgrade cap 120k + prompt rule `plan` → inline code on Fable xhigh [open] +- **Cause**: `~/.claude/settings.json` `"model": "claude-fable-5-1[1m]"` (every session starts on Fable); model-router never moves main above the session model, moves DOWN only under `downgradeMaxTokens` 120000 (LRN-204 cold read) → a long session (faunosteo R4.x, context > 120k) never reaches `implement`/sonnet; prompt rule `(plan|design|architecture…)` → phase plan = best/xhigh each turn ("plan §B.1.7"). No doctrine ceiling: CLAUDE.md allows inline work "doable in a few tool calls", BDR-115 "pin = default, never ceiling". +- **User policy 2026-10-19**: session model Opus 5.5; sonnet writes, opus decides what to write; Fable only for orchestrator reflection/plans and the important audits (security, functional), other judges opus. → next `/feat`: settings model, `judge` split, ceiling rule in CLAUDE.md, BDR superseding part of BDR-066 / BDR-115. Links [[BDR-066]], [[BDR-107]], [[BDR-115]], [[LRN-204]]. diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 13013bc..ff1284d 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -139,6 +139,7 @@ rules: | BDR-119 | 2026-10-16 | impeccable = Build path for all UI; GATE-BLOCK swaps frontend-design for impeccable | accepted | | BDR-120 | 2026-10-18 | Secure-by-default guardrails: always-on rule file + /guardrails stdlib scanner, passwords in api domain | accepted | | BDR-121 | 2026-10-18 | Guardrails fix loop reuses bugfix circuit; scanner = contract oracle, baseline re-pass | accepted | +| BDR-122 | 2026-10-19 | Guardrails split: /a11y standalone on shared scan engine, injection + exposure domains, exposure proven live by read-only probe | accepted | --- @@ -1462,3 +1463,9 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Why**: user ask. Proof by deterministic scanner, never executor's word; no new circuit to maintain. - **Alternatives rejected**: guardrails edits code itself (skips fresh gates); chain to /bugfix per finding (one interview + contract per hit, too heavy for 60 labels); LLM verifier as sole proof (verdict without execution). - **Refs**: feature/secure-by-default 73c25d7. Links [[BDR-120]]. + +## BDR-122 — Guardrails split: /a11y standalone on the shared scan engine, injection + exposure domains, exposure proven live by the read-only probe [accepted] (2026-10-19) +- **Decision**: a11y out of /guardrails → `skills/a11y` (own SKILL, Tab-only walk, report `.claude/audits/A11Y.md`, fix loop = bugfixer + verify-secure gates, scanner oracle A11Y-CLEAR / A11Y-NO-NEW). Shared engine `skills/guardrails/scripts/scanner.py` `Catalogue(name, domains, rule_domains, manual_rules)`, marker = name upper; a11y `scan.py` loads it via `importlib.import_module` after `sys.path` insert (no noqa). Guardrails = 7 domains: api, hosting, supabase, messaging, functions, injection (INJ-*, 6 rules), exposure (EXP-*, 9 rules). `rules/secure-by-default.md` six numbered domains; a11y doctrine → lazy `rules/a11y.md` (`paths:` globs), `rules/web-building.md` points at it. Probe exposure block sourcemap / error-body / fields: fail-closed (unobserved = SKIPPED or ERROR, never CLOSED), every plan path starts with `/`, same scheme+host only, production build target (dev-server OPEN = dev artefact). security-auditor gate keeps `--domain api,supabase`. INJ-SQL-RAW-UNSAFE = WARN (variable ≠ proof), INJ-SQL-CONCAT = FAIL. +- **Why**: user ask 2026-10-18 (keyboard/alt/labels as own skill; SQL/DB injection; browser-visible info). One engine = one CLI contract, two catalogues, no drift. Lazy a11y rule keeps CLAUDE.global.md at 320. +- **Alternatives rejected**: a11y as a `--domain` flag only (user wanted own report + walk); engine copied into skills/a11y (two CLIs drift); exposure probe against dev server (dev artefacts = false OPEN); semgrep-only (blind to live responses, policies). +- **Refs**: branch feature/a11y-split-inj-exp, contract `.claude/tasks/contracts/2026-10-18-guardrails-a11y-split-inj-exp-2210.md`; spec + plan purged at finish (`git show 988038c:docs/superpowers/...`). Supersedes the domain list of [[BDR-120]]; links [[BDR-121]]. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 1d4521a..1053e89 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -626,3 +626,6 @@ rules: - Passwords added on user question ("stockés en clair ?"): gap, rule had none. `checks/passwords.py` (api domain): clear column w/o hash lib, `==` or SQL compare, fast hash, log call, literal. Calibrated 7 projects: zero noise after htpasswd volume-mount FP. Suite 89/89, `make test` green. - Live probe added (user: "est-ce qu'il attaque de l'exterieur ?"). `probe.py` read-only, `--authorized`, env secrets, same-host redirect only, budget-capped. 5 probes confirm a hole from outside (OPEN/CLOSED). Suite 16/16 on a localhost fixture. Classifier blocked edits/tests carrying exploit-language and the SSRF-shaped redirect fixture; full-file Write passed, so probe strings are neutral and interpretation lives in checks.md. - Fix loop added (user: propose fixes via Fable, user accepts, re-pass proves). Reused bugfix circuit: contract criteria with scanner oracle (`--assert-absent`, GUARDRAILS-CLEAR) run by gates.sh, bugfixer executor, verify-secure gates, re-pass `--baseline` (GUARDRAILS-NO-NEW), 2 rounds max. Proposals on route plan (best tier = fable first). Model gate added, census locks updated. + +## 2026-10-19 +- Guardrails split shipped via /ship-feature (feature/a11y-split-inj-exp): /a11y skill on the shared engine, injection + exposure domains, probe exposure block, secure-by-default six domains. SDD 9 tasks, GATE 1 ECARTS(9)→CONFORME (fields CLOSED route, suppressions removed), GATE 2 PASS (7 LOW), opus review 0 Critical / 6 Important fixed. Routing finding: Fable pinned in long sessions (BLK-032), user policy recorded for a later /feat. Merge on user go. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 146f4d0..112892b 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -210,6 +210,9 @@ rules: | LRN-188 | 2026-09-30 | Contract oracle tied to code shape (`grep -A6` line window) breaks on the first refactor while the property still holds; assert the property over the whole unit | writing CHECK oracles | | LRN-189 | 2026-10-06 | `cmd \| grep -q` under pipefail = SIGPIPE false negative (rc 141); `>/dev/null` is NOT a fix (GNU grep treats it like -q); portable = producer out of the pipeline | any bash under `set -o pipefail`, tests and prod | | LRN-190 | 2026-10-06 | Contract oracles: join `\\` line continuations before regex; "lint clean" = no finding beyond base, not zero; never `rm -rf "$var"` inside a CHECK | writing CHECK: lines | +| LRN-219 | 2026-10-19 | Scanner regex over untrusted trees: bound every repeat, cap comment blankers, timing lock on adversarial file | any whole-file regex scanner | +| LRN-220 | 2026-10-19 | Live probe verdicts fail closed by construction: fixture route per negative branch, 3xx = SKIPPED, depth/size limit = SKIPPED never CLOSED | writing probes and their suites | +| LRN-221 | 2026-10-19 | Floor-guard suppressions: remove, never waive; contract CHECK asserts intent (symbol/behaviour), not one code spelling | suppressions, writing CHECK: lines | --- @@ -1814,3 +1817,14 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s - **Context**: model-router bugfix 2026-10-14/15, live scratch mod (`claude -p --plugin-dir`). `complete({model:'claude-opus-5-5', prompt:'ok', maxTokens:1})` resolved 1308 ms with OBJECT `{ isAnswered, text, usage }` (d.ts says string; maxTokens not honored, 43 output tokens). Same call on `claude-fable-5-1` without credits: no settle, no rejection after 900 s (client retries the 429). Plan r1 probed in a loop before deciding → BLOCKERs: unbounded spin on explicit alias, cur probed. - **Apply**: availability check via `complete()` = race vs own timeout, treat timeout + rejection as down, any resolved shape as up; never read `isAnswered:false` as failure (unobserved). Decide first, probe only the move target, once, skip cur and held ids, one re-decision without probe. No hook signal on the probe (Esc must not mark model down); probe sleep counts against 10 s `turn.step` budget. Links [[BLK-030]], [[LRN-207]]. +## LRN-219 — Scanner regex over untrusted trees: bound every repeat, cap every comment blanker, lock with a timing test on an adversarial file +- **Context**: guardrails split 2026-10-19. Challenge + 3 review rounds found quadratic COMMENT / env regexes, unbounded `[^>]*` and `\S+`. Fixes: DATA_ATTR `[\w-]{0,60}`, SCRIPT_SRC `[^>]{1,300}`, TRACE_MARKERS `[^)\n]{0,200}`, SQL_COMMENT `/\*[\s\S]{0,4000}?\*/`, MARKUP_COMMENT tempered ``. Residual ~1.4 s on adversarial 200k file, accepted. +- **Apply**: whole-file regex = bounded repeats, tempered dot for nested delimiters, timing lock in the suite (`guardrails-scan.test.sh`), files > 1 MB listed by path (`Project.large`), `.map` head 4 KB only. Links [[BDR-122]]. + +## LRN-220 — Live probe verdicts fail closed by construction: every negative branch needs its own fixture route, a 3xx reaching a verdict = dropped redirect = SKIPPED, a depth or size limit hit = SKIPPED never CLOSED +- **Context**: same run. GATE 1 verifier: `fields` probe had OPEN + SKIPPED assertions, no CLOSED route. Opus review: three false verdicts (embedded `sourceMappingURL` string → OPEN; off-host map redirect dropped by `_SameHost` → 302 → CLOSED; sensitive key below depth 4 → CLOSED). Each = a code path no fixture route exercised. +- **Apply**: per probe, fixture routes for OPEN, CLOSED, unobservable (SKIPPED), dropped redirect, truncated, oversize; anchor marker comments at line start and take the last; walk bounded bodies fully (iterative). Links [[BDR-122]], [[LRN-219]]. + +## LRN-221 — Floor-guard suppressions: remove, never waive; contract oracles assert intent, not syntax +- **Context**: GATE 1 counted 6 floor findings: `# noqa: E402` ×2 (import after `sys.path.insert`), a `# shellcheck disable=SC2016` copied from another suite (dead: deleting it raised nothing), 3 plan quotes of the same lines. `importlib.import_module` after the insert needs no noqa. Then criterion 16's CHECK grepped `^import scanner` and went red on the legit fix. +- **Apply**: a suppression = first try the construct that needs none; test a copied `disable` by deleting it; a CHECK greps the symbol or behaviour (`scanner.Catalogue` loaded), never one spelling of the code. Links [[BDR-102]]. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index f8ccb5f..655895d 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -1,5 +1,11 @@ # TODO +## 2026-10-19 — guardrails split: /a11y + injection/exposure (feature/a11y-split-inj-exp) +- [x] run — SDD 9/9, gates 0/1/2 green, opus review Importants fixed (c0fdbec, 9275e0d, 63a88bc), capitalize BDR-122 LRN-219..221 BLK-032; merge = user go +- [ ] parked (review Minors): SENSITIVE_KEY matches metadata names (`token_type`, `has_password`, `next_page_token` locked as sensitive); 403 on first map candidate → SKIPPED before header/comment candidates (S3/CloudFront); EXP-HYDRATED-SENSITIVE scans whole route file (Remix/SvelteKit actions); `webpack.dev.js` WARN; `data-password-toggle` WARN; GraphQL `$where: users_bool_exp` → INJ-NOSQL-OPERATOR; misses: Go raw-string Sprintf, Drizzle `sql.raw`, `db.raw`, `rf""`, Supabase `.select()` no arg, multi-line JSX hidden input, triple-quoted f-strings; `IN (${placeholders})` = FAIL (name in judging step); timing lock skips CONCAT (~2.6 s/1 MB); per-language variants without mutant; SKILL.md:96 fields bearer JWT2; large `.map` head misses esbuild/rollup (`"version":3`); URL-encoded `data:` maps. +- [ ] parked (GATE 2 non-blocking, pre-existing on develop): probe `supabase.url` not validated by `_http_url` nor shown in the `--authorized` refusal (MEDIUM, probe.py:168,194: planted SUPABASE_URL would receive the test JWT; `file://` reads CLOSED); same-host redirects not counted in `session.budget` (LOW); `_nonempty_rows` catches ValueError only, deep JSON → RecursionError exit 1 (LOW); scanner text output prints `f.path` / `project.root` without `_printable` (LOW). +- [ ] routing policy /feat (user 2026-10-19, BLK-032): settings model → Opus 5.5; `judge` split (security-auditor + verifier → Fable, plan-challenger/analyzer/code review → opus); executors stay sonnet, "what to write" on opus; ceiling rule: main on Fable never writes code beyond a hotfix edit → dispatched executor; BDR superseding part of BDR-066 / BDR-115. + ## 2026-10-18 — secure-by-default guardrails: 5 domains + /guardrails skill (feature/secure-by-default) User ask: hosting, a11y, Supabase, SMS/email consent, cloud functions must be baseline on every project, API and access secured systematically, plus a skill that tests all of it. Language call: scanner is Python stdlib, not Rust (default-language contraindication: skill scripts here are interpreted, no build step, same as explain-diff checker). diff --git a/.claude/tasks/contracts/2026-10-18-guardrails-a11y-split-inj-exp-2210.md b/.claude/tasks/contracts/2026-10-18-guardrails-a11y-split-inj-exp-2210.md new file mode 100644 index 0000000..7c19594 --- /dev/null +++ b/.claude/tasks/contracts/2026-10-18-guardrails-a11y-split-inj-exp-2210.md @@ -0,0 +1,121 @@ +# CONTRACT — guardrails-a11y-split-inj-exp +- date: 2026-10-18 | flow: ship-feature | branch: develop (feature branch at STEP 4) +- status: active + +## REQUEST (verbatim — IMMUTABLE) +User message (typed): +"en vrai sur le skill guardrails , on va separer l'Accessibilite : Tout au clavier (focus visible), un texte alternatif a chaque image, un label sur chaque champs. ET on va ajouter aux guardrails la recherche de faille sql / injections sur bdd et aussi faire attention a ce que pas trop d'info soit visible sur le navigateur (console, network, dnas inspecter l'element" + +Pre-brainstorm answers (AskUserQuestion, same turn): +- "Séparer a11y" → Skill autonome /a11y: nouveau skill avec son propre rapport et son parcours clavier; reprend les règles A11Y du scanner; /guardrails ne les contrôle plus; /web-validate garde le WCAG complet. +- "Noms" → injection + exposure: domaines `injection` (règles INJ-*) et `exposure` (règles EXP-*). +- "Portée exposure" → Statique + sonde en direct: le scanner repère dans le code les console.log de données, source maps publiques, état hydraté (__NEXT_DATA__) avec champs sensibles, commentaires et attributs data-* internes, erreurs détaillées renvoyées au client. La sonde GET existante vérifie aussi les réponses réelles (en-têtes, source maps servies, corps des erreurs, champs en trop). + +Skill arguments ($ARGUMENTS to /ship-feature): +"Evolve the guardrails skill (skills/guardrails). Decisions already made by the user, do not re-ask: (1) Accessibility becomes a standalone skill /a11y: it takes over the A11Y-* rules and the Tab-only keyboard walk-through (keyboard reachability with visible focus, alt text on every image, a label on every field), has its own report and fix loop, and /guardrails stops checking the a11y domain (secure-by-default.md section 2, guardrails description and --domain list, scan.py DOMAINS, tests and docs updated; /web-validate keeps full WCAG). (2) Two new guardrails domains named `injection` (rule prefix INJ-) and `exposure` (rule prefix EXP-). `injection`: static search for SQL injection and DB injection (string concatenation or interpolation into SQL, raw query calls, unparameterized ORM raw escapes, NoSQL operator injection, shell/command injection into DB tooling), with proof via the existing fix loop. `exposure`: make sure not too much information is visible in the browser (console, network tab, element inspector): static rules for console.log of data, public source maps, hydrated state such as __NEXT_DATA__ carrying sensitive fields, internal comments and data-* attributes, verbose errors or stack traces returned to the client, over-wide API responses; PLUS extend the read-only GET probe (probe.py) to check real responses (source maps served, error bodies, extra fields). Update rules/secure-by-default.md, references/checks.md, SKILL.md, test-prompts.json, tests (lib/tests/guardrails-scan.test.sh and probe test), README/CHANGELOG, profiles and model-router rows if citers need it. Current git state: on develop with two pre-existing uncommitted changes (mods/model-router/routing.json, settings.json) that are not part of this task." + +## CLARIFICATIONS +Q: Separate a11y how? / A: standalone skill /a11y (own report, own keyboard walk, own fix loop); /guardrails drops the domain; /web-validate keeps full WCAG. +Q: New domain names? / A: `injection` (INJ-*) and `exposure` (EXP-*). +Q: Exposure scope? / A: static rules + the existing read-only GET probe extended to real responses. +Pass B (STEP 2 PLAN, 2026-10-18): none. The design approved at the brainstorm gate settled every visible, public-name and scope choice: rule ids and severities, `skills/a11y/scripts/a11y_checks.py`, markers A11Y-CLEAR / A11Y-NO-NEW, report `.claude/audits/A11Y.md`, `rules/a11y.md` (lazy), probe plan keys `exposure.scripts` / `exposure.error_routes`, GUARDRAILS_JWT2 reused as bearer by the fields probe, profiles audit/dev/web/web-full/full/max, CHANGELOG bullet amended in place plus a new /a11y bullet. [gated 2026-10-18] +Amendment 2026-10-19 (after the plan challenge, before implementation; shown at the validation gate): criteria 4, 5 and 11 read the real module path `skills/a11y/scripts/a11y_checks.py`, require the file to exist and require a non-zero rule count, so an empty glob can no longer pass them vacuously. + +## ACCEPTANCE CRITERIA +1. `skills/a11y/SKILL.md` exists, with frontmatter `name: a11y` and an `effort:` matching its routing.json row. + CHECK: test -f 'skills/a11y/SKILL.md' && grep -q '^name: a11y$' 'skills/a11y/SKILL.md' && echo A11Y-SKILL-PRESENT + EXPECT: A11Y-SKILL-PRESENT + EVIDENCE: MET exit=0 marker-found :: A11Y-SKILL-PRESENT +2. /guardrails no longer scans a11y: `scan.py --domain a11y` is a usage error (exit 2) and the default run lists no `[a11y]` block. + CHECK: python3 -B 'skills/guardrails/scripts/scan.py' 'lib/tests/fixtures/guardrails-good' --domain a11y >/dev/null 2>&1; [ $? -eq 2 ] && ! python3 -B 'skills/guardrails/scripts/scan.py' 'lib/tests/fixtures/guardrails-good' | grep -q '^\[a11y\]' && echo A11Y-DOMAIN-GONE + EXPECT: A11Y-DOMAIN-GONE + EVIDENCE: MET exit=0 marker-found :: A11Y-DOMAIN-GONE +3. /guardrails scans `injection` and `exposure`: both appear in the `scanned:` line on the clean fixture, and the clean fixture still reports ` 0 FAIL, 0 WARN`. + CHECK: out=$(python3 -B 'skills/guardrails/scripts/scan.py' 'lib/tests/fixtures/guardrails-good'); echo "$out" | grep '^scanned:' | grep -q 'injection' && echo "$out" | grep '^scanned:' | grep -q 'exposure' && echo "$out" | grep -q ' 0 FAIL, 0 WARN' && echo INJ-EXP-SCANNED-CLEAN + EXPECT: INJ-EXP-SCANNED-CLEAN + EVIDENCE: MET exit=0 marker-found :: INJ-EXP-SCANNED-CLEAN +4. Every INJ-* and EXP-* rule the scanner can emit has a mutant in `lib/tests/guardrails-scan.test.sh` (one `mutant` call per rule id found in the checks modules). + CHECK: n=0; missing=0; for r in $(grep -ho '"\(INJ\|EXP\)-[A-Z0-9-]*"' skills/guardrails/scripts/checks/*.py | tr -d '"' | sort -u); do n=$((n+1)); grep -q "$r" lib/tests/guardrails-scan.test.sh || { echo "no mutant: $r"; missing=1; }; done; [ $n -ge 15 ] && [ $missing -eq 0 ] && echo INJ-EXP-MUTANTS-PRESENT + EXPECT: INJ-EXP-MUTANTS-PRESENT + EVIDENCE: MET exit=0 marker-found :: INJ-EXP-MUTANTS-PRESENT +5. The A11Y-* rules still run, from the /a11y skill's scanner (`skills/a11y/scripts/a11y_checks.py`), on the a11y fixture, and each A11Y rule keeps a mutant in the a11y test suite. [amended 2026-10-19: real path, file must exist, at least 5 rules] + CHECK: test -f 'skills/a11y/scripts/a11y_checks.py' && { n=0; missing=0; for r in $(grep -ho '"A11Y-[A-Z0-9-]*"' skills/a11y/scripts/a11y_checks.py | tr -d '"' | sort -u); do n=$((n+1)); grep -q "$r" lib/tests/a11y-scan.test.sh || { echo "no mutant: $r"; missing=1; }; done; [ $n -ge 5 ] && [ $missing -eq 0 ] && echo A11Y-MUTANTS-PRESENT; } + EXPECT: A11Y-MUTANTS-PRESENT + EVIDENCE: MET exit=0 marker-found :: A11Y-MUTANTS-PRESENT +6. probe.py has exposure probes and the probe suite exercises OPEN and CLOSED for each one. + CHECK: grep -q 'def probe_exposure' 'skills/guardrails/scripts/probe.py' && grep -c 'exposure' 'lib/tests/guardrails-probe.test.sh' | awk '$1>=2{exit 0} {exit 1}' && echo EXP-PROBE-TESTED + EXPECT: EXP-PROBE-TESTED + EVIDENCE: MET exit=0 marker-found :: EXP-PROBE-TESTED +7. Guardrails scan and probe suites, and the new a11y suite, are green. + CHECK: make test suite='lib/tests/guardrails-scan.test.sh lib/tests/guardrails-probe.test.sh lib/tests/a11y-scan.test.sh' >/dev/null 2>&1 && echo GUARDRAILS-SUITES-GREEN + EXPECT: GUARDRAILS-SUITES-GREEN + EVIDENCE: MET exit=0 marker-found :: GUARDRAILS-SUITES-GREEN +8. Censuses that bite on a new skill are green: effort-routing, profile-census, skill-routing-census, model-routing, loops-light. + CHECK: make test suite='lib/tests/effort-routing.test.sh lib/tests/profile-census.test.sh lib/tests/skill-routing-census.test.sh lib/tests/model-routing.test.sh lib/tests/loops-light.test.sh' >/dev/null 2>&1 && echo CENSUS-GREEN + EXPECT: CENSUS-GREEN + EVIDENCE: MET exit=0 marker-found :: CENSUS-GREEN +9. No stale six-domain list or "five domains" wording survives in the skill, rules, agents, README, USAGE or CHANGELOG Unreleased. + CHECK: ! grep -rn 'api,hosting,a11y,supabase,messaging,functions' skills/guardrails rules agents README.md USAGE.md >/dev/null && ! grep -n 'five domains\|five guardrail\|five baseline' rules/secure-by-default.md agents/interviewer.md README.md >/dev/null && echo NO-STALE-DOMAIN-LIST + EXPECT: NO-STALE-DOMAIN-LIST + EVIDENCE: MET exit=0 marker-found :: NO-STALE-DOMAIN-LIST +10. shellcheck clean on the shell surface. + CHECK: shellcheck *.sh hooks/*.sh lib/*.sh && echo SHELLCHECK-CLEAN + EXPECT: SHELLCHECK-CLEAN + EVIDENCE: MET exit=0 marker-found :: SHELLCHECK-CLEAN +11. `references/checks.md` documents every INJ-* and EXP-* rule the scanner emits, and the a11y skill has its own rule reference for every A11Y-* rule. [amended 2026-10-19: real a11y path, file must exist, at least 5 rules] + CHECK: missing=0; for r in $(grep -ho '"\(INJ\|EXP\)-[A-Z0-9-]*"' skills/guardrails/scripts/checks/*.py | tr -d '"' | sort -u); do grep -q "$r" skills/guardrails/references/checks.md || { echo "undocumented: $r"; missing=1; }; done; test -f 'skills/a11y/scripts/a11y_checks.py' && { n=0; for r in $(grep -ho '"A11Y-[A-Z0-9-]*"' skills/a11y/scripts/a11y_checks.py | tr -d '"' | sort -u); do n=$((n+1)); grep -rq "$r" skills/a11y/references/ || { echo "undocumented: $r"; missing=1; }; done; [ $n -ge 5 ] && [ $missing -eq 0 ] && echo RULES-DOCUMENTED; } + EXPECT: RULES-DOCUMENTED + EVIDENCE: MET exit=0 marker-found :: RULES-DOCUMENTED +12. The two pre-existing diffs (mods/model-router/routing.json dialog decisions, settings.json env-key move) are not swept into a feature commit: a routing.json commit on the branch contains only the a11y row. (judgement: read `git log -p develop..HEAD -- mods/model-router/routing.json settings.json`) +13. The scanner stays read-only, stdlib-only, FAIL/WARN/MANUAL only; the probe stays GET/HEAD/OPTIONS plus the opt-in POST burst, never fuzzes, same-host redirects only (judgement against BDR-120 invariants and probe doctrine). +14. The /a11y keyboard walk-through, report and fix loop are specified in its SKILL.md, with the walk marked "not done" when no browser tool is available (judgement). +15. Rule/heading/label citers patched in the same change: secure-by-default.md section numbering and title, guardrails description and argument-hint, interviewer.md domain count, README/USAGE/CHANGELOG, web-validate/guardrails routing boundaries (judgement, grep-by-discipline per BDR-100). +16. Both CLIs run on the shared engine: `skills/guardrails/scripts/scanner.py` defines `class Catalogue`, and both `scan.py` files import it (the a11y one through `importlib.import_module` after its `sys.path` insert, so no `noqa` suppression; oracle amended 2026-10-19 at GATE 1 iteration 1). [gated 2026-10-19] + CHECK: grep -q '^class Catalogue' 'skills/guardrails/scripts/scanner.py' && grep -q '^import scanner' 'skills/guardrails/scripts/scan.py' && grep -Eq '^(import scanner|scanner = importlib\.import_module\("scanner"\))' 'skills/a11y/scripts/scan.py' && echo SHARED-ENGINE + EXPECT: SHARED-ENGINE + EVIDENCE: MET exit=0 marker-found :: SHARED-ENGINE +17. The guardrails and a11y descriptions are 1024 bytes or fewer (BDR-014). [gated 2026-10-19] + CHECK: g=$(awk 'NR==4' skills/guardrails/SKILL.md | sed 's/^description: //' | wc -c); a=$(awk 'NR==4' skills/a11y/SKILL.md | sed 's/^description: //' | wc -c); [ "$g" -le 1024 ] && [ "$a" -le 1024 ] && echo "DESC-$g-$a-OK" + EXPECT: -OK + EVIDENCE: MET exit=0 marker-found :: DESC-1005-906-OK +18. The accessibility doctrine is a lazy rule: `rules/a11y.md` carries a `paths:` frontmatter, `rules/web-building.md` points at it, and `rules/secure-by-default.md` no longer has an Accessibility section. [gated 2026-10-19] + CHECK: grep -q '^paths:' 'rules/a11y.md' && grep -q 'rules/a11y.md' 'rules/web-building.md' && ! grep -qi '^## [0-9]*\. Accessibility' 'rules/secure-by-default.md' && echo A11Y-RULE-LAZY + EXPECT: A11Y-RULE-LAZY + EVIDENCE: MET exit=0 marker-found :: A11Y-RULE-LAZY +19. The exposure probe fails closed: the probe suite asserts SKIPPED for a refused fields route and for a listed script answering 404, and the probe source validates every plan path. [gated 2026-10-19] + CHECK: grep -q 'fields on a 401 is SKIPPED' 'lib/tests/guardrails-probe.test.sh' && grep -q 'answers 404 is SKIPPED' 'lib/tests/guardrails-probe.test.sh' && grep -q 'def _plan_paths' 'skills/guardrails/scripts/probe.py' && echo PROBE-FAIL-CLOSED + EXPECT: PROBE-FAIL-CLOSED + EVIDENCE: MET exit=0 marker-found :: PROBE-FAIL-CLOSED +20. The security-auditor keeps its scanner scope at `api,supabase` (no gate widening). [gated 2026-10-19] + CHECK: grep -q -- '--domain api,supabase' 'agents/security-auditor.md' && echo AUDITOR-SCOPE-KEPT + EXPECT: AUDITOR-SCOPE-KEPT + EVIDENCE: MET exit=0 marker-found :: AUDITOR-SCOPE-KEPT +21. `/a11y` is registered: routing row `"a11y": "reflect"`, present in the full and max profiles, `effort: high` in its frontmatter. [gated 2026-10-19] + CHECK: grep -q '"a11y": "reflect"' 'mods/model-router/routing.json' && grep -q '^a11y ' 'lib/profiles/full.profile' && grep -q '^a11y ' 'lib/profiles/max.profile' && grep -q '^effort: high$' 'skills/a11y/SKILL.md' && echo A11Y-REGISTERED + EXPECT: A11Y-REGISTERED + EVIDENCE: MET exit=0 marker-found :: A11Y-REGISTERED +22. `CLAUDE.global.md` stays at 320 lines and its routing line reads "W3C + WCAG conformance → web-validate". [gated 2026-10-19] + CHECK: [ "$(wc -l < CLAUDE.global.md)" -eq 320 ] && grep -q 'W3C + WCAG conformance → web-validate' CLAUDE.global.md && echo GLOBAL-320 + EXPECT: GLOBAL-320 + EVIDENCE: MET exit=0 marker-found :: GLOBAL-320 +23. The exposure probe is documented as a production-build check with dev-server OPENs marked as dev artefacts, in the guardrails skill and its reference. [gated 2026-10-19] + CHECK: grep -q 'dev artefact' 'skills/guardrails/SKILL.md' && grep -q 'dev artefact' 'skills/guardrails/references/checks.md' && echo PROD-BUILD-CAVEAT + EXPECT: PROD-BUILD-CAVEAT + EVIDENCE: MET exit=0 marker-found :: PROD-BUILD-CAVEAT +24. `/web-validate` no longer carries the bare "a11y" and "accessibility" triggers and points the basics at /a11y. [gated 2026-10-19] + CHECK: ! grep -q '"a11y"' 'skills/web-validate/SKILL.md' && grep -q '/a11y' 'skills/web-validate/SKILL.md' && echo WEB-VALIDATE-BOUNDARY + EXPECT: WEB-VALIDATE-BOUNDARY + EVIDENCE: MET exit=0 marker-found :: WEB-VALIDATE-BOUNDARY + +## FILE SCOPE +- skills/guardrails/SKILL.md, scripts/scanner.py (new engine), scripts/scan.py, scripts/probe.py, scripts/checks/{common,injection,exposure,supabase,passwords}.py, scripts/checks/a11y.py (moved to skills/a11y/scripts/a11y_checks.py), references/checks.md, test-prompts.json +- skills/a11y/** (new: SKILL.md, scripts/scan.py, scripts/a11y_checks.py, references/checks.md, test-prompts.json) +- rules/secure-by-default.md, rules/a11y.md (new, lazy), rules/web-building.md (two fragments point at rules/a11y.md) +- skills/seo/SKILL.md, skills/harden/SKILL.md (routing citers) +- lib/tests/guardrails-scan.test.sh, lib/tests/guardrails-probe.test.sh, lib/tests/a11y-scan.test.sh (new), lib/tests/fixtures/guardrails-good/**, lib/tests/fixtures/a11y-good/** (new, if split) +- lib/tests/model-routing.test.sh, lib/tests/loops-light.test.sh (lock lists), lib/profiles/*.profile, mods/model-router/routing.json (a11y row only) +- agents/interviewer.md, agents/security-auditor.md (if the domain subset changes), agents/bugfixer.md (if /a11y reuses it) +- lib/verify-secure-loop.md, lib/contract-interview.md (flow enum, if /a11y gets the guardrails circuit) +- README.md, USAGE.md, CHANGELOG.md, CLAUDE.global.md (routing line, only within the 320 budget) +- skills/web-validate/SKILL.md (trigger boundary), skills/onboard/SKILL.md (a11y dispatch, if rerouted) +- docs/superpowers/specs/2026-10-18-guardrails-a11y-split-design.md, docs/superpowers/plans/2026-10-18-guardrails-a11y-split.md (ship-feature transient artifacts, committed during the run for the SDD reviewers, auto-purged by `gitflow finish`, BDR-065; the plan was approved at the STEP 3 validation gate) [gated 2026-10-19] diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eb8326..18712e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ 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 five 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), accessibility (keyboard, visible focus, alt text, field labels), 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). `/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. 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, 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-`), 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`, `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 `), 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 ||model= effort=|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 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 11 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`. - **Manual-push mode**: `git config gitflow.autopush false` (human-set) now stops every push the gitflow lib makes, not only the post-commit / post-merge hooks. `gitflow start` and `finish` branch, commit and merge locally and push nothing; `gitflow delete` leaves the `origin/` copy in place and prints `git push origin --delete
` for the user to run. `hooks/unpushed-guard.sh` stays silent at turn end in this mode and opens each session with one `ℹ manual push mode:` line counting the commits no remote holds across every local branch; an unparseable or unreadable `gitflow.autopush` value is treated as manual push mode too, and that line names it. `hooks/push-guard.sh` (PreToolUse, `Bash|Monitor`) refuses any `git push` Claude types while `gitflow.autopush` reads false in the session cwd or in a literal `-C`/`cd` directory the command names (global config counts outside a repo); the refusal tells the user to run it with `! git push`. It reads the mode through the same lib verb as every other reader and fails closed: an unparseable or unreadable value reads as manual, and an internal error, a missing `lib/gitflow.sh`, more than 20 distinct directory tokens in one command (capped before any token is classified), a `cd`/`-C` directory token mixing quoted and unquoted parts, or a payload jq cannot parse whose raw text looks like a push refuse the push (these pathological cases fire in auto mode too). Directory tokens are read as whole shell words, adjacent quoted segments and backslash escapes included. Once the text looks like a push, the command is split into simple commands (quotes, escapes, separators, heredoc bodies dropped) and a push must be git's own subcommand in one of them: `grep "git push"`, `git log -S "git push"`, `git config --get push.default`, `git stash push`, a heredoc quoting a push or a commit message naming one are allowed; `bash -c` scripts are re-checked, wrappers (`sudo`, `env`, `eval`, `xargs`, `timeout`, `git subtree`...) and assignments keep the text verdict. The misses listed in its header fall to a new `autoMode.soft_deny` rule that no request in the turn clears. The session banner adds `🔒 push : manual (autopush=false) — ! git push` when the key reads false, and `🔒 push : manual (autopush bad) — ! git push` when the value is invalid. Skills read the mode through a new lib verb, `bash ~/.claude/lib/gitflow.sh push-mode`: it prints `auto`, `manual` or `invalid` (rc 0) and names an invalid value on stderr (printable characters only, 64 at most). It is the one reader a skill may call, since the `git config` read of the key is denied to Claude. Skills push nothing on their own, except the `/release-candidate` tag in auto-push mode on an explicit go. Every "on origin" or "not pushed" line they print comes from `git rev-list --count origin/
..
` read after the fact, with the complete `! git …` command when something is left for the user to push. An invalid value (anything but unset, true or false, or a read that fails) is manual push mode for every reader and is named where it is read (see Fixed). Tests: `lib/gitflow-test.sh` T11b (push-mode verb), T18m and T18q blocks, `lib/tests/unpushed-guard.test.sh` T10-T16, `lib/tests/push-guard.test.sh` (98 checks). diff --git a/CLAUDE.global.md b/CLAUDE.global.md index b1af37c..010c3f1 100644 --- a/CLAUDE.global.md +++ b/CLAUDE.global.md @@ -273,7 +273,7 @@ cryptic names. finishing-a-development-branch → `gitflow finish` (human signal) systematic-debugging → bugfix verification-before-completion → the verifier gates -- SEO+GEO → seo (GEO only → geo); W3C + WCAG a11y → web-validate; +- SEO+GEO → seo (GEO only → geo); W3C + WCAG conformance → web-validate; security audit (secrets, CVE, OWASP) → cso - Media generation (image, video, audio, brand kit), explicit ask → Higgsfield pack, off by default: `bash ~/.claude/lib/toggle-external.sh diff --git a/README.md b/README.md index 58a50f5..7560329 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ commands, settings, secrets, maintenance. Doctrine: the session model (Fable) does main-loop reflection ONLY — brainstorm, plan, contract, audit judgment, gates, loop decisions — enforced by a blocking gate (`lib/model-gate.md`) at the entry -of the 15 reflection skills (the orchestrators plus `/analyze`): the skill -calls the model-router `route` tool and its answer, which names the model -id the main loop runs on, is the witness. A non-Fable/Opus id or the mod -off stops the skill (`/route on` resumes the mod). Nothing dispatched +of the 17 reflection skills (the orchestrators, `/analyze`, `/guardrails` and +`/a11y`): the skill calls the model-router `route` tool and its answer, which +names the model id the main loop runs on, is the witness. A non-Fable/Opus id or +the mod off stops the skill (`/route on` resumes the mod). Nothing dispatched inherits silently: typed agents run on their model-router row, their `model:` frontmatter being the off-state floor; built-ins get an explicit `model=` at every call site. @@ -228,10 +228,11 @@ a different package, ships its own conflicting `graphify` bin) — see | `/reconcile` | Confront declared status (TODO, registries) against real git/fs state — surface stale items | | `/pdf-translate` | Translate a PDF to another language, output as HTML (via Vision) | | `/explain-diff` | Explain a diff, commit, branch or PR as one self-contained HTML page (background, intuition, code walkthrough, 5-question quiz), saved outside the repo | -| `/guardrails` | Audit the five baseline guardrails (hosting, a11y, Supabase RLS, SMS/email consent, cloud functions) plus API hygiene (auth, CORS, secrets, password storage): deterministic scanner, then judgment, report in `.claude/audits/GUARDRAILS.md`. Then proposes fixes, applies the ones you accept and re-scans to prove each one. `--live ` adds a read-only probe that confirms a hole from outside | +| `/guardrails` | Audit the six baseline guardrails (hosting, Supabase RLS, SMS/email consent, cloud functions, injection, browser exposure) plus API hygiene (auth, CORS, secrets, password storage): deterministic scanner, then judgment, report in `.claude/audits/GUARDRAILS.md`. Then proposes fixes, applies the ones you accept and re-scans to prove each one. `--live ` adds a read-only probe that confirms a hole from outside (routes, CORS, rate limit, and against a production build: source maps served, error bodies, sensitive keys) | +| `/a11y` | Accessibility baseline: keyboard reachability with a visible focus, an alt on every image, a label on every field. Deterministic scanner, Tab walk on `--live`, report in `.claude/audits/A11Y.md`, fixes proposed with the wording as your choice, applied on acceptance and re-scanned to prove them. Full WCAG → `/web-validate` | | `/close` | End-of-session ritual — alias for `/capitalize --ritual` (dedup + TODO reconcile + 3-question reflection) | | `/harden` | Web hardening audit — HTTPS/TLS, HSTS, CSP, security headers | -| `/web-validate` | W3C HTML/CSS validity + WCAG 2.1 accessibility audit | +| `/web-validate` | W3C HTML/CSS validity + WCAG 2.1 conformance audit (keyboard/alt/label basics → /a11y) | | `/geo` | GEO-only audit — AI-search visibility (ChatGPT, Perplexity, Claude, Gemini…) | | `/client-handover` | Final project delivery — audits + branded deliverable (Markdown / HTML / PDF) | | `/profile` | Activate a skill profile (web / seo / web-full / full / max / backend / design / dev / qa / audit / minimal) (default: full) | diff --git a/USAGE.md b/USAGE.md index a1d29d5..80958dc 100644 --- a/USAGE.md +++ b/USAGE.md @@ -115,12 +115,13 @@ Tu veux... | État réel du travail ouvert | `/reconcile` | | Fin de session (= /capitalize --ritual) | `/close` | | Audit web (TLS, CSP, headers) | `/harden` | -| Validité HTML/CSS + a11y | `/web-validate` | +| Validité HTML/CSS + conformité WCAG | `/web-validate` | +| Accessibilité de base (clavier, alt, labels) puis corriger | `/a11y` | | Visibilité IA (GEO seul) | `/geo` | | Livraison client finale | `/client-handover` | | Traduire un PDF | `/pdf-translate` | | Comprendre un changement pas suivi | `/explain-diff` | -| Auditer garde-fous (RLS, a11y, consentement, fonctions, mots de passe) puis corriger | `/guardrails` | +| Auditer garde-fous (RLS, consentement, fonctions, mots de passe, injection SQL, fuites navigateur) puis corriger | `/guardrails` | | Sonder le projet en direct (lecture seule, cible à toi) | `/guardrails --live ` | | Changer profil skills | `/profile` | | Audit/polish design (anti-slop) | `/impeccable` | @@ -161,11 +162,12 @@ Tu veux... | `/reconcile` | Connaître l'état réel du travail ouvert (TODO/registres douteux) | Confronte statut déclaré vs git/fs réel | | `/close` | Fin de session | Alias de /capitalize --ritual — dedup + TODO + réflexion 3 questions | | `/harden` | Audit sécurité web (SSL, CSP, HSTS) | Projet web avec config HTTP | -| `/web-validate` | Audit W3C + WCAG a11y | Avant livraison projet web | +| `/web-validate` | Audit W3C + conformité WCAG | Avant livraison projet web ; bases clavier/alt/labels → /a11y | +| `/a11y` | Vérifier clavier, focus visible, alt, labels puis corriger | Scanner déterministe, parcours Tab sur `--live`, rapport `.claude/audits/A11Y.md`, propositions à valider (textes d'alt et de label = ton choix), re-passe qui prouve chaque correction | | `/client-handover` | Livraison client | Audits finaux + livrable brandé | | `/pdf-translate` | Traduire un PDF vers une autre langue | Sortie HTML fidèle (images, layout, style préservés) | | `/explain-diff` | Comprendre un commit, une branche ou une PR qu'on n'a pas suivis | Page HTML autonome hors du repo : contexte, intuition, code, quiz de 5 questions | -| `/guardrails` | Vérifier hébergement, a11y, Supabase RLS, consentement SMS/email, fonctions cloud, stockage des mots de passe | Scanner déterministe, jugement, rapport `.claude/audits/GUARDRAILS.md`, propositions de correction à valider, re-passe qui prouve chaque correction ; `--live ` sonde en lecture seule | +| `/guardrails` | Vérifier hébergement, Supabase RLS, consentement SMS/email, fonctions cloud, stockage des mots de passe, injection SQL, exposition navigateur | Scanner déterministe, jugement, rapport `.claude/audits/GUARDRAILS.md`, propositions de correction à valider, re-passe qui prouve chaque correction ; `--live ` sonde en lecture seule ; sonde `exposure` sur un build de production (source maps, corps d'erreur, clés sensibles) | | `/impeccable` | Audit/polish design + détecteur anti-slop déterministe | 23 verbes ; `npx impeccable detect` (exit 0/2) | | `/tour` | Sweep groupé sur un ou plusieurs projets | Sécu + nettoyage + reconcile + doc, boucle jusqu'à un pass propre | | `/route` | Voir ou fixer la route du mod model-router | show / clear / off / on / reload / pending / ask on\|off / / model=… effort=… / switch on\|off / classify on\|off (classifieur de prompt) / verbose on\|off (transitions seules) | diff --git a/agents/bugfixer.md b/agents/bugfixer.md index bcbc8f8..412725c 100644 --- a/agents/bugfixer.md +++ b/agents/bugfixer.md @@ -1,6 +1,6 @@ --- name: bugfixer -description: Bug-fix EXECUTOR — dispatched by /bugfix (or /guardrails 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 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. tools: Read, Edit, Write, Bash, Grep, Glob model: sonnet effort: medium diff --git a/agents/interviewer.md b/agents/interviewer.md index 0d5861b..6cafcfd 100644 --- a/agents/interviewer.md +++ b/agents/interviewer.md @@ -24,7 +24,7 @@ Gather context. Produce complete PROJECT BRIEF as single source of truth. | "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 five guardrail domains apply, 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 | +| 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 | | 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 | diff --git a/lib/contract-interview.md b/lib/contract-interview.md index 870cd11..1c453a6 100644 --- a/lib/contract-interview.md +++ b/lib/contract-interview.md @@ -114,7 +114,7 @@ Template: ```markdown # CONTRACT — -- date: | flow: | branch: +- date: | flow: | branch: - status: active ## REQUEST (verbatim — IMMUTABLE) diff --git a/lib/profiles/audit.profile b/lib/profiles/audit.profile index 7e15b9f..61d8602 100644 --- a/lib/profiles/audit.profile +++ b/lib/profiles/audit.profile @@ -6,6 +6,7 @@ cso harden personal guardrails personal +a11y personal analyze personal # SEO / GEO / web standards diff --git a/lib/profiles/dev.profile b/lib/profiles/dev.profile index cc07f11..300b4e0 100644 --- a/lib/profiles/dev.profile +++ b/lib/profiles/dev.profile @@ -19,6 +19,7 @@ code-clean personal commit-change personal explain-diff personal guardrails personal +a11y personal # Dev-lifecycle skills (agent-skills trio) observability-and-instrumentation external diff --git a/lib/profiles/full.profile b/lib/profiles/full.profile index 55d18cc..b792eef 100644 --- a/lib/profiles/full.profile +++ b/lib/profiles/full.profile @@ -46,6 +46,7 @@ geo personal web-validate personal harden personal guardrails personal +a11y personal analyze personal cso diff --git a/lib/profiles/max.profile b/lib/profiles/max.profile index 5060c45..2792c78 100644 --- a/lib/profiles/max.profile +++ b/lib/profiles/max.profile @@ -47,6 +47,7 @@ geo personal web-validate personal harden personal guardrails personal +a11y personal analyze personal cso diff --git a/lib/profiles/web-full.profile b/lib/profiles/web-full.profile index 9376f75..1c49fcf 100644 --- a/lib/profiles/web-full.profile +++ b/lib/profiles/web-full.profile @@ -34,6 +34,7 @@ geo personal web-validate personal harden personal guardrails personal +a11y personal analyze personal # === Perf + canary =================================================== diff --git a/lib/profiles/web.profile b/lib/profiles/web.profile index ee53a99..7d32538 100644 --- a/lib/profiles/web.profile +++ b/lib/profiles/web.profile @@ -28,6 +28,7 @@ refactor personal # Validation companion (basic W3C/a11y check during build) web-validate personal +a11y personal # External: design skills emil-design-eng external diff --git a/lib/tests/a11y-scan.test.sh b/lib/tests/a11y-scan.test.sh new file mode 100755 index 0000000..10b2790 --- /dev/null +++ b/lib/tests/a11y-scan.test.sh @@ -0,0 +1,129 @@ +#!/usr/bin/env bash +# lib/tests/a11y-scan.test.sh — floor of the /a11y scanner catalogue. +# The clean fixture must scan with zero FAIL and zero WARN. Each mutant breaks +# one rule on a copy of it and must raise that rule at the expected severity +# (positive control). The A11Y-CLEAR / A11Y-NO-NEW markers, the gates.sh +# contract wiring and the rejection of guardrails rules are checked too; the +# shared engine itself is proven in guardrails-scan.test.sh. +set -u +ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +SCAN="$ROOT/skills/a11y/scripts/scan.py" +GOOD="$ROOT/lib/tests/fixtures/a11y-good" +WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT +PASS=0; FAIL=0; LAST_OUT="" + +check() { # check