Commit Graph
279 Commits
Author SHA1 Message Date
bchanot 89334f2901 fix(rules): named dep-dir globs match, inline-paths error names the form, gitignore newline guard, no | in globs 2026-10-26 18:04:15 +01:00
bchanot dbd20dd575 feat(generators): onboarder and scaffolder emit docker/testing/ci path rules from templates/project-rules 2026-10-26 17:55:01 +01:00
bchanot 433c10d78f refactor(claude-md): four sections become .claude/rules path rules (phase 0) 2026-10-26 17:47:53 +01:00
bchanot ce8e60ee7c chore(gitignore): un-ignore .claude/rules/ here and in the gitflow socle 2026-10-26 17:46:24 +01:00
bchanot e7d800f053 feat(hooks): InstructionsLoaded logger, the proof channel for path rules 2026-10-26 17:44:17 +01:00
bchanot abfa4167ea feat(rules): lib/project-rules.sh check/matches/sections/extract + suite 2026-10-26 17:41:07 +01:00
bchanot 8e93507b19 fix(router): only Haiku 4.x takes no effort; Haiku 5.x gets its route's
The no-effort rule was keyed on every claude-haiku id, so Haiku 5.5 ran at the engine default instead of its phase effort (mechanical: low). The guard now names Haiku 4.x; status-reporter pins effort: low.
2026-10-25 22:19:55 +01:00
bchanot 2202964d02 feat(router): the /model picker asks its scope; a hand pick always switches
A pick in the picker is held (PreModelSwitch deny), then the same project / conversation / everywhere question runs; only Everywhere reaches the native write to user settings.json. A model chosen in that dialog bypasses the cold-read caps but waits while held down.
2026-10-25 20:36:49 +01:00
bchanot 1fde5bbc76 feat(router): /model <name> asks its scope: project, conversation, everywhere
This project writes model into .claude/settings.local.json and sets a sticky route; This conversation sets the sticky route only; Everywhere runs the native write. Links refused in the project tree, native never runs after an answer.
2026-10-25 16:21:39 +01:00
bchanot 34c6534620 Merge feature/router-keyword-cap into develop 2026-10-23 17:40:14 +02:00
bchanot 5c6e368937 test(gitflow): start outside a git repo exits non-zero 2026-10-23 17:09:56 +02:00
bchanot 70e0f9ac41 feat(lib): code-origin.sh tells our code from foreign code 2026-10-23 16:54:15 +02:00
bchanot 786ee13c24 feat(router): keyword rules, ultrathink and dispatches set effort only
Prompt rules and the derived orchestrate route write effort-only routes, so
they never lift main above the session model; a held run keeps its model.
Fable on main comes from skill rows, the route tool or /route (BDR-123).
2026-10-23 01:24:16 +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 ef13713f09 feat(doctrine): main on Fable writes no code past the /hotfix scope
The Sub-agents rule gains the ceiling and hands the rest to /feat or /bugfix; README and the challenge citers now say the main loop reaches Fable through best-tier rows from an opus session. /deploy's floor follows its verify row and its stale changed entry goes.
2026-10-21 22:18:16 +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 f08efa3b9a chore(design): impeccable is the Build path, gate blocks on it instead of frontend-design
GATE-BLOCK swaps frontend-design for impeccable; Build line, gate prose, advisor rows follow. Detector rule count 45 to 61. BDR-119.
2026-10-16 18:19:29 +02:00
bchanot e91dcb3f12 feat(commits): follow project convention, else short messages
New lib/commit-message.md looks for a documented convention first. Without one, messages stay under 50 words at medium technical level.
2026-10-16 11:49:26 +02:00
bchanot 2ce203a2da feat(model-router): cold-read cap on main-loop downgrades, switch on by default, classifier may route down
The main loop may now move down to a cheaper model by default
(mainModelSwitch true, fail-closed picker). Both caps measure the COLD
READ a switch costs: the context minus what the target model's prompt
cache already holds, from a per-model served record written on every
main step (1 h TTL, cleared by /clear and /route reload; a smaller
context than the record counts as cold). downgradeMaxTokens defaults to
120000, upgradeMaxTokens keeps 200000; no return bypass is needed since
a warm return is cheap by construction.

The prompt classifier writes the full phase route: coding and
bookkeeping guesses move main down under the switch and the cap; a guess
never ranks above the session model; a mid-turn ultrathink floor keeps
its model; a user /effort typed between turns drops the guess for that
turn only (engine baseline is now per turn). A model-loaded helper skill
inside a best-tier run moves effort only. Main routed onto a model whose
window the context outgrew returns to the session model. The skip line
is said once per cap crossing; the toast names a cap hold; the status
line shows the switch only when off.
2026-10-13 01:13:06 +02:00
bchanot 84446612ae refactor(toggle-external,profile): one tool roster, split arms, shared gstack helpers
code-clean B5 (enable_tool split into enable_gstack/
enable_external_single/enable_pack), B7 (enable_skill into
enable_gstack_skill/enable_linked_skill/enable_plugin_skill), B9
(cmd_show into _show_entries/_show_plain/_show_grouped, `_show_plain`
ends with an explicit return 0), B18 (locals), B19 (comment).

/refactor C4: tool_kind/tool_source replace the 3 hand-copied name
lists with the MANAGED_TOOLS roster (exact-match loop), and disable_* is
split to mirror enable_*.

/refactor C5: gstack_skills/gstack_parked_names/gstack_park/
gstack_unpark move into lib/gstack-removed.sh, the only sourced file the
fixture suites copy, and profile.sh and toggle-external.sh both use
them.

496-run golden capture identical; make test 47 green, shellcheck 0.
2026-10-12 22:51:41 +02:00
bchanot 4c966ebdfc fix(toggle-external): --help prints the whole header, all 14 tools
usage() printed lines 3-26 with a hardcoded range, but the tool list
runs to line 32, so 8 of the 14 tools were missing. It now reads
`sed -n '3,/^# ====/p' | sed '$d'` and stops at the closing banner, with
no line numbers. Logged in .claude/audits/BUGS-FOUND.md.
2026-10-12 22:51:37 +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 e54a2b5d61 feat(model-router): wave 4-B — prompt classifier
Plain composer prompts with no route in force get a turn-scoped effort
from $.model.classify (design/analysis/coding/bookkeeping/chat → phase
effort, effort only, never the model). Bounded by a 3 s clock race, a
user interrupt neither counts nor writes, three failures in a row pause
it for cooldownMinutes (one toast, status marker, cleared by /route
reload). No dialog, no routing.json write on a classified route. New
Config key `classify` (default on, pickSwitch), `/route classify on|off`
session toggle, `/route show` line and argumentHint. An explicit user
/effort beats the guess (engineBase check).

Docs: README classifier paragraph, USAGE row + sentence, CHANGELOG,
effort-shift.md. Kit suite 428 tests.
2026-10-11 21:05:29 +02:00
bchanot cd8d72f01f feat(model-router): wave 3-C — /route forget <name|all|projects>
Clears first-use decisions from the tracked routing.json through the
existing writer: a name is forgotten in every table (confirmed, changed
with the row restored to its recorded shipped phase under guards, project
exceptions pruned) and asked again; all and projects ask a confirmation in
the engine dialog (Cancel first) and hold the single-dialog slot; nothing
is written when there is nothing to forget; the answer names what was
restored and the frontmatter floor to realign when one was aligned; the
route tool has no forget path. Docs name the new writer. Kit suite 232 → 284.

Contract .claude/tasks/contracts/2026-10-11-model-router-w3c-forget-1457.md,
plan r3: 3 lenses + 1 confirmation, feater + 3 rounds (one real defect),
GATE 0 MET, verifier at the cap on coverage (user-accepted), security PASS.
2026-10-11 16:14:59 +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 604a6c4411 feat(model-router): wave 3-B — first-use dialog with context, model then effort on change
The dialog now explains what it asks about: the skill's description (from
its SKILL.md frontmatter, five YAML forms, first sentence, cleaned), the
agent's description (from agent.offer), the phase's new 'about' line in
routing.json, and the real model id and effort the next step runs on.
Options Later / Keep / Change; Change asks the model (fable, opus, sonnet,
haiku with their tier role), then the effort among those the phases of
that model offer, then the scope; the pair maps to an existing phase (rows
stay phase names; the row's current phase wins a tie; same phase = Keep).
A main-loop phase (T3) is Later / Keep only. A main-row change toasts the
real decision and the /route switch hint when the pick is a downgrade.
Descriptions pass a hardened read (name allowlist, stat kind, size cap)
and clean(). Kit suite 190 → 232; W3-A dialog tests migrated.

Contract .claude/tasks/contracts/2026-10-11-model-router-w3b-dialog-1240.md,
plan r3: 3 lenses (2 BLOCKERs: inline rows, phase edits) + 1 confirmation,
feater + 2 rounds, GATE 0 MET, verifier CONFORME (3rd pass), security PASS.
2026-10-11 14:10:24 +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