Commit Graph
151 Commits
Author SHA1 Message Date
bchanot 70e0f9ac41 feat(lib): code-origin.sh tells our code from foreign code 2026-10-23 16:54:15 +02:00
bchanot 801992a2ce fix(tests): mods suite gates validate on the --strict exit code
CLI 2.1.306 prints an advisory plugin-directory section (ICON_MISSING,
blocking: false) that the whole-output `warning` grep counted as a
failure. The verdict is now the rc of `claude plugin validate --strict`
(per-file warnings → 1, directory advisory never), through one helper
shared with a positive control on two scratch manifests.
2026-10-22 21:07:25 +02:00
bchanot b961ce6b98 Merge feature/routing-audit-phase into develop
# Conflicts:
#	.claude/memory/journal.md
#	.claude/memory/learnings.md
#	.claude/tasks/TODO.md
2026-10-21 17:45:01 +02:00
bchanot a7d747c65f feat(model-router): audit phase puts the verifier and security-auditor on Fable
New best-tier phase audit (xhigh) carries both merge gates; their opus frontmatter stays the outage floor, since inTier never writes below a tier head. The census floors best-tier rows on the second alias, and the citers now name the audit row.
2026-10-21 16:50:47 +02:00
bchanot 5a98c2c095 fix(guardrails): probe fails closed on budget, redirects and unread bodies; rules lose five false positives and gain seven misses
The probe trusted the plan's Supabase url, followed redirects for free,
crashed on deep JSON and stopped at the first unconfirmed map candidate.
Rules now scope hydrated state to the export chunk, silence dev configs,
UI-suffixed data attributes, GraphQL types and metadata keys, and catch
Go raw strings, triple-quoted f-strings, sql.raw, empty select() and
multi-line hidden inputs; text output is sanitised; per-variant locks.
2026-10-21 00:13:32 +02:00
bchanot 63a88bc91d fix(guardrails): CONCAT before RAW, probe row newline kept, malformed urls handled, sa.text matched 2026-10-19 12:17:56 +02:00
bchanot 9275e0d82b fix(guardrails): Ruby where interpolation stays FAIL under CONCAT, PHP shell variables always count 2026-10-19 11:59:40 +02:00
bchanot c0fdbec3c1 fix(guardrails): probe map and fields verdicts fail closed, console rule sees public/, raw escape WARN, argv silent, plan validation 2026-10-19 11:56:25 +02:00
bchanot 6c0006bce3 fix(guardrails,a11y): CLOSED fields probe assertion, drop floor suppressions 2026-10-19 10:52:27 +02:00
bchanot 5643e9dbd4 fix(guardrails): bound DATA_ATTR, SCRIPT_SRC, TRACE_MARKERS and the comment blankers, SENSITIVE_KEY aligned with the spec, 5xx map SKIPPED, base64 inline maps only, RecursionError and supabase shape guarded, large .map head read 2026-10-19 01:19:40 +02:00
bchanot 60d447e544 feat(a11y): skill (scan, keyboard walk, report, fix loop on the bugfix circuit), lazy rules/a11y.md, profiles, locks 2026-10-19 00:48:09 +02:00
bchanot 811077da2b fix(guardrails): probe reads inline maps anywhere in the body, SKIPPED on an oversize map, validation never raises, bounded trace marker, .map guess from the path 2026-10-19 00:45:25 +02:00
bchanot 8b6472b8c4 feat(guardrails): exposure probe (source maps served or inline, error bodies, sensitive keys) that fails closed; every plan path validated; fetch keeps error bodies 2026-10-19 00:42:13 +02:00
bchanot 6e79d182e3 feat(a11y): standalone scanner on the shared engine (A11Y-CLEAR / A11Y-NO-NEW); guardrails drops the a11y domain 2026-10-19 00:40:26 +02:00
bchanot b4ef6ae359 fix(guardrails): bounded comment/env patterns, multi-line errorhandler guard, WIDE mutants 2026-10-19 00:38:21 +02:00
bchanot d46201c561 feat(guardrails): exposure domain (EXP-*): console data, source maps (config, public dir, large files), hydrated state, shipped comments, data attributes, error bodies in routes, debug mode, wide responses 2026-10-19 00:34:57 +02:00
bchanot 7500a618fe feat(guardrails): injection domain (INJ-*): per-language SQL concat and raw escapes, dynamic EXECUTE, PostgREST, NoSQL, shell into DB tools; shared code_files/hits/dedupe helpers 2026-10-19 00:32:06 +02:00
bchanot 73c25d759e feat(guardrails): propose, apply accepted fixes, re-pass to prove them
After the report the skill proposes fixes (plan phase), stops for the
user's acceptance, applies accepted ones via bugfixer and the
verify-secure gates, then re-scans. scan.py gains --assert-absent
(contract oracle, positive control) and --baseline (no new hit).
2026-10-18 19:04:13 +02:00
bchanot f0bcbfef46 feat(guardrails): read-only live probe to confirm a hole from outside
probe.py observes a running target the user owns and names, driven by a
plan built from the static findings. Five probes: anon-read, cross-user,
no-auth route, CORS reflection, capped rate-limit burst. GET/HEAD/OPTIONS
only, --authorized gate, secrets from the environment, same-host redirect
only, bounded request budget. SKILL STEP 5, checks.md reference, docs.
Suite guardrails-probe.test.sh (16 checks) against a localhost fixture.
2026-10-18 18:49:51 +02:00
bchanot 558c49e1a1 feat(guardrails): secure-by-default rule and /guardrails scanner
Always-on rules/secure-by-default.md: hosting, a11y, Supabase RLS,
SMS/email consent, cloud functions, API hygiene incl. password storage.
Stdlib scanner (FAIL/WARN/MANUAL) + skill, 89-check suite, auditor
gate wiring, profiles, routing row (plus Explore rows confirmed
through the router dialog).
2026-10-18 18:10:20 +02:00
bchanot faedb98699 fix(explain-diff): arrow class no longer collides with edge callout; bundle fill_template.py
Eval iteration 1: the callout 'edge' variant picked up the diagram connector styles, and all three skill runs hand-wrote a template filler. fill_template.py takes values.json with @fragment files, escapes </ in the quiz; suite 21 checks.
2026-10-17 13:10:37 +02:00
bchanot b353fac2ba feat(explain-diff): explain a diff as one self-contained HTML page
Adapted from Geoffrey Litt's explain-diff gist: background, intuition, grouped code walkthrough, 5-question quiz, saved outside the repo. Bundled template, components catalog and checker with its test suite. Row reflect; profiles full, max, dev.
2026-10-17 13:05:01 +02:00
bchanot 381ed9fa5d chore(code-clean): lint directives, guarded cd, hook regex split, helper extractions
A1 drop unused `import gzip`; B1/B2 file-level shellcheck directives
placed before `set -u`; B3 `cd "$REPO" || exit 1`; B4 hook regex split
into `pattern+=` lines (sha256 of $pattern unchanged); B11
`_build_parser`/`_dispatch` pulled out of google_seo `_cli`; B20
detect-plugins header names update-all.sh; C2 prune-memory deterministic
suite wired into SUITES (literal path); C3 `_refuse_outside_allowlist`
moved up in deploy-commit.

No behavior change except B3 (a failed cd now exits 1) and C2 (one more
suite). B5/B7/B9/B18/B19 land in the refactor commit.
2026-10-12 22:51:28 +02:00
bchanot d08929d0e8 Merge bugfix/model-router-residuals into develop
# Conflicts:
#	.claude/tasks/TODO.md
2026-10-11 23:42:47 +02:00
bchanot a3fbb9ae3f fix(model-router): close the accepted residuals of waves 1-4
Kill switch fails closed: a present-but-unreadable override at first load
or a non-boolean enabled turns the router off (logged); /route reload says
when the previous config was kept. Prompt rules with nested quantifiers
are dropped; a config path that is not a regular file reads as failed;
caught errors log kind + code only (errWord); rejected keys are masked in
logs (keyWord), alias keys match KEY_NAME, prototype names are never keys;
offers capped at 256; a models alias without a fallback list is ranked at
the end of the default chain; canonical matches a table id at a '-'
boundary only; logCall/noteMain cannot unroute a step; route-tool failure
text no longer claims nothing was routed.

Repo side: mods suite probes the 'claude plugin test' usage line, doctor
bounds plugin list to 60 s, update-all skips @skills-dir mods.
Kit 431/431, full make test green.
2026-10-11 23:39:01 +02:00
bchanot fe7d5cdb28 fix(push-guard): argv check — a push must be git's own subcommand
The text regex becomes a prefilter. The command is split into simple
commands by an awk tokenizer (quotes, escapes, ; && || | ( ) backticks,
heredoc bodies dropped) and a push is only a simple command whose argv[0]
is git (or */git) with push or send-pack as its first non-option word.
grep "git push", git log -S, git config --get push.default, git stash
push, heredocs and commit messages quoting a push are no longer denied.
bash|sh|zsh -c scripts are re-checked (depth 3); wrappers (sudo, env,
eval, xargs, timeout, git subtree...), assignments whose value reads as
a push, a missing awk or > 2000 simple commands keep the text verdict.
Prefilter also matches "git" push (quote characters stripped).
Suite 98 -> 124 checks.
2026-10-11 23:24:39 +02:00
bchanot 938c3d1a67 chore(agents): security-auditor floor aligned to its judge row (model: opus); model-routing lock updated 2026-10-11 14:25:45 +02:00
bchanot 22455c051f feat(model-router): wave 3-A — first-use route confirmation, decision memory, project exceptions
routing.json (tracked, reached through the plugin directory) is now the
single source of the phase table and of every skill/agent row, plus the
decisions: confirmed rows/phases, changed rows (from/to) and projects
exceptions keyed by a normalized git remote (credentials never stored, no
machine paths). First use of a rowed typed skill, a rowed agent spawn or a
main-loop phase opens the engine's dialog (Later / Keep / two alternative
phases; Other = a phase name); a change asks Everywhere or This project
only. One dialog at a time, never in headless, never inside an agent,
never written by the model: only a dialog answer or /route ask writes,
serialized, size-capped, never creating the file. Layers: routing.json <
~/.claude/model-router.json; the project tree is never read. /route
pending, /route ask on|off. Census reads rows and phases from the file and
tolerates a user-changed row (WARN). Kit suite 86 → 190 tests.

Contract .claude/tasks/contracts/2026-10-10-model-router-w3a-confirm-1201.md,
plan r4: 3 lenses + 1 confirmation, feater + 4 rounds, GATE 0 MET,
verifier CONFORME then re-verify after security, security BLOCK(1) fixed
then PASS. Live: T2 dialogs answered by the user from the hot-loaded mod.
2026-10-11 11:48:25 +02:00
bchanot 1f2d33b7a6 feat(model-router): wave 2-B — orchestrators declare phases, shifters and pins removed, frontmatter = off-state floor
The 15 Skill(effort-*) citers now call mcp__model-router__route per phase
(orchestrate at a dispatch span, reflect/plan for the skill's own level,
apply at the bookkeeping tail, escalate at the verify-secure caps); built-in
judgment dispatches carry an explicit effort= param. lib/effort-shift.md is
the route doctrine, lib/model-gate.md the mod rule (route answer = witness,
/route on as remedy). Deleted: skills/effort-*, lib/effort-pins.txt/.sh,
lib/model-check.sh, their tests, the installers' re-apply blocks. The mod
drops its Skill(effort-*) bridge. The tracked model:/effort: frontmatter
stays as the off-state floor, census-locked equal to the rows
(lib/tests/effort-routing.test.sh rewritten, 140 checks; analyzer → xhigh).

Contract .claude/tasks/contracts/2026-10-10-model-router-w2b-1045.md, plan
r4 § W2-B: GATE 0 MET, verifier ECARTS(7) then CONFORME 10/10, security
PASS, full make test green (design-tool-gate env red only).
2026-10-10 11:24:54 +02:00
bchanot 6430ac65ec feat(mods): model-router active in every session — skills-dir link, mods suite, doctor section, CLAUDE.md
Tracked relative symlink skills/model-router -> ../mods/model-router: Claude
Code loads the mod in place as model-router@skills-dir wherever link.sh
links ~/.claude/skills (no CLAUDE_CODE_PLUGIN_DIRS: absolute paths in the
tracked settings.json). Engine-laid mods/*/tsconfig.json gitignored.
lib/tests/mods.test.sh: manifest name, link target, claude plugin validate
and test per mod, capability-probed, time-bounded, SKIP with reason.
doctor.sh: fail-soft Mods section (link by -ef, one guarded plugin list).
CLAUDE.md: mods/ section (loading, per-machine enabled:false switch,
dev-copy shadowing, tests).
2026-10-09 10:51:13 +02:00
bchanot 3c59333fcf fix(push-guard): single reader, whole-word dir tokens, payload fallback, bad-value banner
Run D2 of manual-push mode (BDR-114).

- push-guard sources lib/gitflow.sh once (absolute path) and reads each
  candidate dir through gitflow_push_mode; a missing lib denies.
- Dir tokens are extracted as whole shell words: a fully quoted token
  (inner apostrophe allowed) is resolved, a backslash-escaped space is
  unescaped deterministically, a token mixing quoted and unquoted parts
  is refused (fail closed) instead of resolving to its parent.
- A payload jq cannot parse is scanned as raw text with its JSON escapes
  folded; a push-looking one gets the static deny through the trap.
- The 20-token cap runs before any per-token classification (a flood of
  20 000 tokens is refused in 0.13 s; T58 locks it under 5 s).
- `case "$mode"` has a deny default; missing core tools warn and allow.
- T42 compares the deny list against main (the last release) instead of
  HEAD; literal-true, mixed-token, broken-payload, lib-missing and
  banner-on-bad-value cases added (98 checks).
- session-start banner reads the mode through the verb and shows
  `push : manual (autopush bad)` on an unparseable value.
- tour hints quote "<abs project>".
2026-10-07 17:11:56 +02:00
bchanot 472cccbc52 fix(gitflow): every autopush reader fails closed and names an invalid value
Run D1 of manual-push mode (BDR-114). `git config --bool --default true
gitflow.autopush` only covered a MISSING key: an unparseable value made
git die with empty output, the `= false` test failed, and every push ran
again. A typo on a work machine silently re-enabled the pushes it was
meant to stop.

- lib/gitflow.sh: `_gitflow_push_off` reads the mode through the lib
  verb (`push-mode`); anything but `auto` is push-off, and the verb's
  stderr line names an invalid value during start/finish.
- Emitted post-commit/post-merge hooks (POSIX sh, standalone): push only
  when the key reads `true` or is unset; `false` exits quietly; any
  other result prints one stderr line ("NOT pushed, treated as manual
  push mode") and exits 0. Mirrors gitflow_push_mode.
- .githooks/ and githooks/ regenerated files-only through `emit-hook`
  (no config read or write; .git/config hash unchanged).
- hooks/unpushed-guard.sh: mode from the lib verb (absolute lib path
  resolved before any cd, no temp file); anything but auto is manual;
  the SessionStart line names an invalid or unreadable value.
- Tests: gitflow-test T18q block (invalid → start, hook and finish push
  nothing and say so; `true` → the hook pushes; emitted hook is
  POSIX-clean), unpushed-guard T14 rewritten.
2026-10-07 16:45:31 +02:00
bchanot 6468eda495 fix(push-guard): fail closed on token floods, git failures and quoted cd targets
Hardening after the security gate on a2ac018 (3 MEDIUM, all closed and
re-measured):

- dir tokens are deduplicated and capped: more than 20 distinct cd/-C
  targets in one command denies before any git fork (20000 tokens: 0.15 s
  against the 10 s hook timeout that used to turn a flood into an allow)
- a git or cd failure while reading gitflow.autopush denies instead of
  reading as auto (git absent, usage error, unenterable dir); the key
  being unset is the only "auto" answer; the decision is recorded only
  after one candidate was evaluated cleanly, else the EXIT trap denies
- cd/pushd/-C targets that follow a quote or backtick (bash -c '…') are
  extracted; quote characters are excluded from unquoted tokens

User decision (contract, gated): both fail-closed cases also fire in
auto mode on such pathological commands; silence in auto mode holds for
every ordinary push. Header limits list the residual misses (quotes or
backslashes inside a token, cumulative relative cd, unparseable payload)
backed by the soft_deny rule. Tests: 71 checks (T48–T50b added).
2026-10-07 12:34:56 +02:00
bchanot a2ac0189f7 feat(gitflow): push-guard hook denies Claude's git push in manual-push mode
Run B of manual-push mode (BDR-111). With `gitflow.autopush false`
nothing stops Claude from typing `git push` itself: the `ask` tier is
inert under auto mode. This adds the mechanical block the user chose.

- hooks/push-guard.sh (PreToolUse, matcher Bash|Monitor, timeout 10):
  detects a push in the command text (strict, quote-stripped loose and
  alias patterns; backslash-newline folded in bash, BSD sed/grep only),
  reads gitflow.autopush in the payload cwd and in every literal -C/cd
  dir the command names (global config counts outside a repo), denies
  with the documented JSON form and a reason that tells the user to run
  the command with `!`. Unparseable value = manual (fail closed); once
  a push is detected an EXIT trap emits a static deny on any internal
  error. jq missing = one stderr warning, allow (sibling-hook policy).
- settings.json: hook wiring; 18 deny entries closing the write forms
  of the human-only toggle (any `git … config` spelling, section
  removal/rename, `-c`, config env overrides, direct edits of git config
  files); one soft_deny on pushing in manual mode in any form, with no
  per-turn clearance; the routing-around rule names hook refusals.
- hooks/session-start.sh: `🔒 push : manual (autopush=false) — ! git push`
  banner line when the key reads false (padding in bytes).
- lib/tests/push-guard.test.sh: 61 checks (push forms, over-blocks,
  invalid value, global key, fail-closed trap, no-jq, wiring, banner).

Known limits are listed in the hook header; the soft_deny rule is the
backstop. Run C (skills that push on their own) and run D (fail-closed
readers everywhere) follow. Do not enable manual mode at work before C.
2026-10-07 12:24:35 +02:00
bchanot 2fc88304ac feat(gitflow): manual-push mode honoured by the lib, quiet unpushed-guard
`gitflow.autopush false` (human-set git config) now means "nothing is
pushed" end to end, not only in the post-commit/post-merge hooks:

- lib/gitflow.sh: `_gitflow_push_off` is the single reader of
  GITFLOW_NO_PUSH / gitflow.autopush for the lib's push sites; `start`
  and `finish` stop pushing in manual mode. `gitflow_delete` checks out
  the base that contains the branch and drops a lagging upstream before
  `git branch -d` (LRN-161: `-d` judges against the upstream when set).
  Skipped remote deletes say `left in place`; `_gitflow_sync_base`
  replaces the silent `pull --ff-only || true` and warns when a base is
  behind origin and cannot fast-forward.
- hooks/unpushed-guard.sh: manual mode is silent at Stop and gives one
  `ℹ manual push mode:` line at SessionStart counting every local
  branch; an unparseable value is named and treated as auto.
- CLAUDE.global.md: manual-push mode doctrine, "ahead = defect" scoped
  to auto mode.
- Tests: gitflow-test T18m block (T18m0, T18i-T18o, 7 cases),
  unpushed-guard T10-T16.

Follow-ups (TODO.md): run B push-guard hook + settings deny widening +
banner; run C skills that push on their own (/close STEP 5C, …).
Do not enable manual mode on the work machine before B and C land.
2026-10-06 17:49:20 +02:00
bchanot 0efdff0d55 fix(portability): make test green on macOS, GNU-only idioms replaced
The suite and seven libs assumed a GNU userland: `cmd | grep -q` under
pipefail (grep exits at the first match, the producer takes SIGPIPE,
rc 141 → 15 false "merged into" FAILs in gitflow-test), `sed -i` with no
suffix, `wc -l` padding compared as a string, `stat -c`, `touch -d`,
`realpath -m` (gstack-links refusal never fired), bare `timeout` off the
sanitized PATH (design gate READY BUT UNVERIFIED), `grep -oP` (update-all
emptied the plugin list). Thirteen suites were red on this machine.

Portable forms on the native userland of both OS: producer captured out
of the pipeline, `sed -i.bak` in tests and a temp-sibling `sed_profile`
on the user dotfile, `tr -d ' '`, python3 perms, `touch -t`, a
`realpath -m` emulation that refuses `..`, perl `alarm` for the 15 s
bound, `sed -n` token extraction. Regression tests: gstack-links T4b,
doctrine-citers Alphabet/Alpha flip, profile-set-managed T18 (failing CLI
no longer aborts `set`), new portability-census suite over the tracked
shell files. Linux run deferred (see TODO).
2026-10-06 15:10:20 +02:00
bastien 4c7db8893b fix(higgsfield): report upstream drift on every enable; final review fixes 2026-09-30 16:35:45 +02:00
bastien a1f7893786 test(higgsfield): drop the two shellcheck suppressions in the suite 2026-09-30 16:17:34 +02:00
bastien bbd3d209d3 feat(update): refresh the Higgsfield CLI and skill pack 2026-09-30 16:10:08 +02:00
bastien 83043412d0 feat(install): Higgsfield step 8.6; login offers test stdin alone 2026-09-30 16:08:34 +02:00
bastien acb6cd7cb4 feat(toggle): higgsfield and higgsfield-websites toggles 2026-09-30 16:06:43 +02:00
bastien 21df604eb0 fix(higgsfield): guard the suite's cleanup trap 2026-09-30 16:05:37 +02:00
bastien 67b7c98d70 feat(higgsfield): skill pack sync helper and CLI probes, with suite 2026-09-30 16:03:49 +02:00
bastien 0c135a0ab7 fix(effort): five residual LOW on lib/effort-pins.sh
INT/TERM trap removes the mktemp sibling and exits 130 (traps restored,
never EXIT); re-read message honest and reached by a stubbed test; rejected
map line printed through printf %q; suite guards mktemp -d and skips the
read-only case under root. Cases T13b, T15, T15b, T16.
2026-09-29 16:45:57 +02:00
bastien bb46ee22eb fix(effort): harden lib/effort-pins.sh (security gate, 4 LOW)
Last map line without newline read; unclosed frontmatter skipped with an
err; level re-read after write, mismatch counted as failed; mktemp + cp -p
+ mv, temp removed on failure; rc 1 on any rejected or failed entry.
Cases T11-T14 in the fixture suite; contract criteria 8-9.
2026-09-29 15:36:18 +02:00
bastien cd3a745857 fix(effort): resync re-applies the pins after the 21st pack refresh, order locked
The 21st pack refresh (update-all 7.4) rewrites every 21st-* SKILL.md after
the superpowers refresh; the re-apply now sits after it, the census locks
the order in both scripts. Contract: criterion 3 anchor, shellcheck
directive authorized, tracked design-motion-principles copy gated.
2026-09-29 15:09:45 +02:00
bastien c859ae256f feat(effort): entry level on every skill next to its model pin (BDR-108)
- lib/effort-pins.txt (map) + lib/effort-pins.sh (idempotent re-apply)
  replace the hardcoded brainstorming/writing-plans loop; called after the
  last vendoring step of install-plugins.sh AND update-all.sh (the resync
  dropped the pins until the next make plugin)
- design stack high uniform (last loaded wins), superpowers, agent-skills,
  21st pack pinned from the map; skills-perso low, pdf-translate medium,
  site-motion high
- doctrine: design stack loads paired with the first Read; one level per
  stack (CLAUDE.global.md, lib/effort-shift.md)
- lib/effort-audit.py prints thinking coverage per scope (sub-agent records
  carry no thinking count on ~94 % of requests)
- census map-driven + fixture suite lib/tests/effort-pins.test.sh; docs
  README/USAGE/CHANGELOG; contract + TODO plan
2026-09-29 13:15:41 +02:00
bastien 58c3a3e9b7 fix(effort): re-raise judgment dispatches, planning re-asserts, pairing caveat, dedupe audit script (final review I1-I3) 2026-09-28 20:48:27 +02:00
bastien 98ef991958 docs(effort): BDR-107 id, CHANGELOG entry, spec corrected for the rulings (vendored pins, exclusions, pairing rule) 2026-09-28 20:20:05 +02:00
bastien 1e3339358c feat(effort): transcript audit script for the thinking/cost split 2026-09-28 20:14:00 +02:00