Merge bugfix/passive-cost-source into develop
This commit is contained in:
commit
ab7cada20b
15 files changed
+139
-117
No files matched your search
@@ -7,6 +7,7 @@
|
||||
- hooks/session-start.sh:200-217 + lib/detect-plugins.sh:49-52 (`detect_uiux_pro_max`) — the banner "ALWAYS ON" row and the ui-ux-pro-max toggle row read user-scope settings.json / plugin cache, not the effective profile (`profile.sh current --plain`, BDR-134 single source of truth): a dev or minimal project shows ui-ux-pro-max on; pr-review-toolkit on in max/audit is not shown. Severity: low (banner only). Discovered while: code-clean 2026-11-09 (phase 5 sweep). Not fixed.
|
||||
FIXED 2026-11-10 (/bugfix, bugfix/banner-effective-profile): new `list_on_plugins` (lib/detect-plugins.sh) = effective profile for the ids lib/profiles manages, user-scope true for the others; the ✅ row reads it (model-router now shown, user choice) and `detect_uiux_pro_max` = cache AND enabled; pipefail-safe for doctor.sh; test lib/tests/session-banner.test.sh SB1-SB8.
|
||||
- hooks/session-start.sh:177-183 + agents/plugin-advisor.md:193,197,211,226,233,263 vs doctor.sh:520-526 — passive-cost constants disagree (banner/advisor: gstack 2750, ui-ux-pro-max 400, context7 200, graphify 300; doctor dropped gstack/context7/graphify 2026-09-28 as double counting, ui-ux-pro-max 670); agents/status-reporter.md:26-30 names doctor as source of truth. Severity: low (estimates). Discovered while: code-clean 2026-11-09. Not fixed.
|
||||
FIXED 2026-11-10 (/bugfix, bugfix/passive-cost-source, split by the user): stale hand figures removed from the banner (💰 budget row + `_plugin_costs` + now-dead `detect_plan` deleted), plugin-advisor and status-reporter (cost → `make doctor`); doctor keeps its measured ui-ux 670; tests SB9/SB10, detect-plan.test.sh renamed hook-recursion-guard.test.sh. Measured-cost API = TODO feature.
|
||||
- hooks/session-start.sh:404-408 (`_digest_journal`) — greps `^- ` without skipping HTML comments; templates/memory/journal.md:19-21 holds `- <line …>` bullets inside `<!-- -->`, so a template-born project prints "- journal: <line 3-5 max>" in the session digest until its first journal write. Fix template and digest together. Severity: low. Discovered while: code-clean 2026-11-09 (phase 4 sweep). Not fixed.
|
||||
FIXED 2026-11-09 (/hotfix, bugfix/digest-journal-comment): the digest skips HTML comment blocks (opener anchored at line start, CommonMark rule; an inline `<!--` in a bullet stays text), test SD18; the template stays byte-identical (copied by onboarder/init-project/memory.sh), so fixing the template was not needed.
|
||||
- agents/status-reporter.md:35 + agents/plugin-probe.md:22-23,69 — report installed (cache) or user-scope `claude plugin list` state as "active"; the per-project state is the PROFILE line (`current --plain`). Severity: low. Discovered while: code-clean 2026-11-09. Not fixed.
|
||||
|
||||
@@ -397,3 +397,9 @@ rules:
|
||||
- **Friction**: session banner plugin rows showed user-scope state, not project's. dev project showed `ui-ux-pro-max` in `🟢 ON`; audit project hid `pr-review-toolkit`; /status read `~/.claude/plugins/cache` as active.
|
||||
- **Real cause**: `detect_uiux_pro_max` tested plugin cache only (installed = on); ✅ row grepped `"<id>": true` in user `~/.claude/settings.json`. PROFILE_PLAIN (`profile.sh current --plain`) already held effective state, unused there. Found by code-clean 2026-11-09 (G1, G4).
|
||||
- **Solution**: `list_on_plugins` in lib/detect-plugins.sh: profile `plugin:<id>=on` for managed ids, user-scope true for rest, awk set difference, `return 0`. ✅ row + detect_uiux_pro_max (cache AND enabled) + status-reporter read it; plugin-advisor INPUT names PROFILE. Test lib/tests/session-banner.test.sh SB1-SB8. Commit 556d0e6.
|
||||
|
||||
## BLK-047 — Passive-cost constants stale in banner and advisor, budget row on wrong denominator [resolved 1971b8d] (2026-11-10)
|
||||
- **Date**: 2026-11-10
|
||||
- **Friction**: passive-cost figures disagreed: banner `_plugin_costs` (gstack 2750, ui-ux-pro-max 400, context7 200, graphify 300) and plugin-advisor `~Nt` vs doctor.sh (ui-ux 670 only). Banner 💰 row divided by per-plan "budget" (Pro 11000, Max 20000).
|
||||
- **Real cause**: hand-copied constants. 2026-09-28 skill-catalog prune re-measured doctor (ui-ux 400 → 670, gstack/context7/graphify dropped: skills already in catalog) but missed banner + advisor citers (BDR-100 class). Measured 2026-11-10: gstack 3 packs ~445t (~196/120/129), ui-ux ~666t, context7 = CLI, find-docs skill always loads.
|
||||
- **Solution**: user split. Bugfix removed constants, 💰 row, budget block, dead `detect_plan` (BLK-043 source); advisor + status-reporter point to `make doctor`; detect-plan.test.sh → hook-recursion-guard.test.sh; SB9/SB10. Commit 1971b8d. Measured-cost API = TODO feature (spec input: two challenge rounds in plan 2026-11-10-passive-cost-source-1330).
|
||||
@@ -715,3 +715,4 @@ rules:
|
||||
|
||||
## 2026-11-10
|
||||
- 2026-11-10: /bugfix G1+G4 banner effective profile: list_on_plugins (profile managed ids, user scope rest) feeds ✅ row, detect_uiux_pro_max, /status; 2 challenge rounds (doctor pipefail BLOCKER r2), gates MET/CONFORME/PASS; 556d0e6, changelog 6cdc374.
|
||||
- 2026-11-10: /bugfix G2 passive-cost constants: 2 challenge rounds (FATAL r2) showed measured-cost API = feature; user split: constants, banner 💰 budget row, dead detect_plan removed, agents → make doctor; 1971b8d (amended, force push by user), docs 9777a47; API in TODO.
|
||||
@@ -2021,3 +2021,8 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
- **Context**: `list_on_plugins` r2 draft = brace group piped into while loop, ending on `grep -vxF -f`; `detect_uiux_pro_max` = `list_on_plugins | grep -q`. doctor.sh runs `set -euo pipefail`. Grep selecting nothing exits 1; `grep -q` early exit gives SIGPIPE 141. Under pipefail both leak: detect reads OFF though match found. Challenger ran it: `list rc=1`, `detect rc=1`. Test suites run `set -u` only, so tests stayed green.
|
||||
- **Pattern**: lib function sourced by a pipefail caller: capture output into var, test with here-string (`grep -q x <<<"$(fn)"`); set difference in awk not `grep -v -f` (empty pattern file also non-portable); assignment fallbacks `|| var=""`; explicit `return 0` on printing functions.
|
||||
- **Future application**: any lib/*.sh sourced by doctor.sh or another `set -euo pipefail` script; add one test case run inside a `set -euo pipefail` subshell.
|
||||
|
||||
## LRN-275 — Silenced git add with one missing pathspec stages nothing; check commit stat (2026-11-10)
|
||||
- **Context**: G2 commit. `git add a b lib/tests/detect-plan.test.sh 2>/dev/null` after `git mv` of that path: pathspec missing → git aborts WHOLE add, stderr silenced. Commit 63832fd landed with only pre-staged rename under full fix message; post-commit auto-push published it. Repair = amend + force push (user ran it: force push denied to Claude).
|
||||
- **Pattern**: never `2>/dev/null` on `git add`; one bad pathspec stages nothing. After any commit check `git show --stat HEAD` against intended file list before reporting.
|
||||
- **Future application**: every commit step in skills (bugfix, feat, hotfix, commit-change) after a rename/delete; stage renamed paths by new name only.
|
||||
@@ -138,6 +138,9 @@ Shared rules for every phase:
|
||||
- [ ] D3 visible (= docs backlog P34): packs vocabulary in agents/plugin-advisor.md (:99 PROFILE template in the old `profile.sh current` format, :126-129 rollback, gstack ON/OFF rules, context7 ON) and USAGE.md:181,232,233,1090,1092,1095
|
||||
- [ ] D4 skill behavior: skills/prune-memory STEP 1.A/3 detection (per-entry frontmatter, raw `status:` lines) → read statuses via `memory.sh index` (v1 + v2); keep example IDs 9xx (RED-7)
|
||||
- [ ] D5 user rules: rules/web-security.md vs rules/secure-by-default.md: strict duplicates (web-security :11, :19, "Login rate limiting," in :20) and password wording conflict ("bcrypt/argon2" vs "argon2id (bcrypt or scrypt otherwise)"); cookie flags, upload type/size, forced HTTPS, security headers are unique to web-security
|
||||
- [x] G1+G4 fixed (bugfix/banner-effective-profile, merged a655b06); G3 fixed (merged 9f9821e); G2 hand figures removed (bugfix/passive-cost-source, plan `.claude/tasks/plans/2026-11-10-passive-cost-source-1330.md` r3); G5 open
|
||||
- [ ] feature (G2 split, user 2026-11-10): measured passive-cost API, one source for doctor / /status / plugin-advisor (probe COSTS field). Spec input = the two challenge rounds in the G2 plan: unit = pack or ON plugin (skills + agents + commands descriptions; pr-review-toolkit ~1550t, example-skills ~2350t), doctor counts OFF packs (higgsfield, extras), `detect_plugin_dev` globs the wrong cache level and ignores enabled state, `?` for not-installed or empty units, rc-0 sentinels (`costs-unavailable`/`unknown`) for doctor's `set -euo pipefail`, profile.sh failure → unknown, `python3 -I` (probe runs in the user's project), installPath from installed_plugins.json. Doctor keeps its measured ui-ux 670 until then.
|
||||
- [ ] D3 add-ons from G2 (plugin-advisor.md): plan-budget WARN :317 (unreachable: plugin-gate never sends PLAN, detect_plan gone), :42 "absolute COST ESTIMATE still reported", :105 `(budget: ~<N>t | n/a)`, :222 "passive cost estimate = highest-cost package profile", "0t passive" claims for impeccable / design-motion-principles (:226 :227 :268 :269); USAGE.md :248 "Budget Pro (~11k tokens/5h)", :494 `(~400t)`, :923 `(~200t)`; session-banner.test.sh SB10 `gone()` passes on a missing file (add an existence check)
|
||||
- [ ] D6 project rule: .claude/rules/graphify-vendored.md says `graphify install --platform claude` "touches nothing else", but graphifyy 0.9.67 appends a `# graphify` block to ~/.claude/CLAUDE.md (= CLAUDE.global.md); `graphify claude install` writes into the caller's cwd, so the install-plugins.sh trap protects $REPO only when run from $REPO
|
||||
- [ ] parked (code-clean 2026-11-09): hooks/rtk-rewrite.sh:84 no-op `[ "$CMD" = "$REWRITTEN" ] && REWRITTEN="$CMD"`: remove with the next real rtk-hook edit, re-pin `hooks/.rtk-hook.sha256` + rtk-rewrite.test.sh T13 in the same step
|
||||
- [ ] deferred (BDR-123): remap inline-writing best-tier skills (design Build stack, writing-skills, deprecation-and-migration, /tour single-project, /audit-delta 3d, /harden STEP 3); stale citers skills/feat/SKILL.md:6, skills/code-clean/SKILL.md:36; + impeccable row in routing.json (design Build stack has none; frontend-design has `reflect`; census test pins the table)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# CONTRACT — passive-cost-source
|
||||
- date: 2026-11-10 | flow: bugfix | branch: bugfix/passive-cost-source
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
G2 from .claude/audits/BUGS-FOUND.md (code-clean 2026-11-09): passive-cost constants disagree. hooks/session-start.sh:177-183 (`_plugin_costs`: gstack 2750, ui-ux-pro-max 400, plugin-dev 100, context7 200, graphify 300) and agents/plugin-advisor.md:193,197,211,226,233,263 vs doctor.sh:520-526 (gstack/context7/graphify dropped 2026-09-28 as double counting, ui-ux-pro-max 670); agents/status-reporter.md:26-30 names doctor.sh's constants block as the source of truth. Fix: one source of truth for the constants (doctor.sh's block or a shared lib file both read), banner and advisor aligned to it; regression test. Mark BUGS-FOUND G2 FIXED. Note: detect_uiux_pro_max now follows the effective profile (bugfix/banner-effective-profile, a655b06). make test needs GATES_TIMEOUT=600 + PATH=$HOME/.bun/bin:$PATH (LRN-271). Foreign-code style. Advisor output vocabulary (D3) out of scope.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: single source of truth? / A: measured at runtime from the real skill descriptions (user, 2026-11-10) [gated]
|
||||
Q: banner 💰 row (per-plan budget denominator)? / A: remove it (user, 2026-11-10) [gated]
|
||||
Q: after two challenge rounds the measured-cost API proved a feature; scope? / A: split: this /bugfix removes the stale hand figures and the dead banner path (detect_plan included); the measured-cost API becomes a /ship-feature in the TODO; doctor keeps its measured 670 until then (user, 2026-11-10) [gated]
|
||||
Q: binding plan? / A: .claude/tasks/plans/2026-11-10-passive-cost-source-1330.md r3 "Fix plan (r3)" (orchestrator)
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. Symptom gone: no stale per-plugin token figure left in the banner, status-reporter or plugin-advisor (the deferred plan-budget WARN line excepted); the 💰 row and detect_plan are gone; regression cases present and green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && make test suite=lib/tests/session-banner.test.sh 2>&1 | tail -1 | grep -q 'all suites green' && grep -q 'SB9' lib/tests/session-banner.test.sh && grep -q 'SB10' lib/tests/session-banner.test.sh && ! grep -qE '_plugin_costs|TOKEN_WARN|detect_plan' hooks/session-start.sh && ! grep -q 'detect_plan' lib/detect-plugins.sh && ! grep -qE '~[1-9][0-9-]*t' agents/status-reporter.md && ! grep -v 'plan budget' agents/plugin-advisor.md | grep -qE '~[1-9][0-9-]*t' && echo SYMPTOM-GONE
|
||||
EXPECT: SYMPTOM-GONE
|
||||
EVIDENCE: MET exit=0 marker-found :: SYMPTOM-GONE
|
||||
2. Recursion-guard suite renamed and green without the detect_plan cases.
|
||||
CHECK: cd /home/bchanot/Documents/claude && [ ! -e lib/tests/detect-plan.test.sh ] && make test suite=lib/tests/hook-recursion-guard.test.sh 2>&1 | tail -1 | grep -q 'all suites green' && ! grep -q 'detect_plan' lib/tests/hook-recursion-guard.test.sh && echo GUARD-OK
|
||||
EXPECT: GUARD-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: GUARD-OK
|
||||
3. Build/tests green (full suite, GATES_TIMEOUT=600, bun on PATH); shellcheck at warning level clean on the touched shell files.
|
||||
CHECK: cd /home/bchanot/Documents/claude && shellcheck -S warning hooks/session-start.sh lib/detect-plugins.sh lib/tests/session-banner.test.sh lib/tests/hook-recursion-guard.test.sh && make test 2>&1 | tail -1 | grep -q 'all suites green' && echo GREEN
|
||||
EXPECT: GREEN
|
||||
EVIDENCE: MET exit=0 marker-found :: GREEN
|
||||
|
||||
## FILE SCOPE
|
||||
hooks/session-start.sh, lib/detect-plugins.sh, lib/tests/detect-plan.test.sh → lib/tests/hook-recursion-guard.test.sh (git mv), agents/status-reporter.md, agents/plugin-advisor.md, lib/tests/session-banner.test.sh; bookkeeping (orchestrator): .claude/audits/BUGS-FOUND.md, .claude/tasks/TODO.md
|
||||
@@ -0,0 +1,41 @@
|
||||
# FIX — passive-cost-source (/bugfix G2, 2026-11-10) — r3 split after two challenge rounds
|
||||
|
||||
Source: .claude/audits/BUGS-FOUND.md entry G2.
|
||||
|
||||
## Diagnosis
|
||||
Symptom: four places state per-plugin passive token costs and disagree.
|
||||
- hooks/session-start.sh:170-195 `_plugin_costs` (gstack 2750, ui-ux-pro-max 400, plugin-dev 100, context7 200, graphify 300) summed over TOGGLE_ACTIVE, divided by a plan "budget" (detect_plan: max 20000, pro 11000, :163-167), printed as the 💰 row (:270) above 25 %.
|
||||
- agents/plugin-advisor.md: hardcoded `~400t` (ui-ux, :215 :225 :267), `~2750t` (gstack :230), `~200t` (context7 :237), `~100t` (plugin-dev :255 :259), recommended-sets "Passive cost" column (:196-204: ~0t ~600t ~3400t ~400t ~200t), :150 "Saves ~3000-5000t", :152 "~3100t saved", :243 "~800t base only".
|
||||
- doctor.sh:520-528 counts only ui-ux-pro-max (670) on top of the skill catalog; gstack/context7/graphify constants were dropped 2026-09-28 (skill-catalog prune) as double counting because their skills sit under ~/.claude/skills and are already in `skill_catalog_stats`.
|
||||
- agents/status-reporter.md:27-33 greps doctor's `PLUGIN_TOKENS + <n>` lines as the source of truth.
|
||||
Root cause: hand-copied constants. The 2026-09-28 prune re-measured and fixed doctor (ui-ux 400 → 670, plan .claude/tasks/plans/2026-09-28-skill-catalog-prune-0554.md:240-243) but missed the banner and advisor citers (BDR-100 class).
|
||||
Evidence (measured 2026-11-10, chars of the `description:` via lib/skill-routing-census.py extract_description, /4): gstack 3 packs 15+8+4 skills 1781 chars → ~445t (constant 2750); ui-ux-pro-max 7 skills 2663 chars → ~666t (doctor 670 ✓, banner/advisor 400 ✗); context7 = find-docs skill 1326 → ~331t (200); graphify skill 371 → ~93t (300).
|
||||
Second defect on the same row: the 💰 percentage uses a per-plan "budget" denominator, the category error doctor removed (doctor.sh:500-505: passive footprint competes with the context window, not a quota). With measured costs all toggles total ~1500t, below the 25 % threshold, so the row never shows.
|
||||
|
||||
## User decisions (2026-11-10) [gated]
|
||||
- Single source = measured at runtime from the real skill descriptions (same method as doctor's catalog); no hand constants anywhere.
|
||||
- Banner 💰 row removed (budget calc gone); doctor.sh stays the context-cost estimate (% of the 200k window).
|
||||
|
||||
## Split (user decision 2026-11-10, after challenge round 2) [gated]
|
||||
Two challenge rounds showed the runtime-measurement API is a feature, not a bugfix (open definitions: agent descriptions count, pr-review-toolkit ~1550t / example-skills ~2350t, doctor counts OFF packs, `detect_plugin_dev` globs the wrong cache level and ignores enabled state, `?` for empty units, rc-0 sentinels, profile.sh failure → unknown, python `-I`). This /bugfix (r3) only REMOVES the wrong hand figures and the dead banner path; the measured-cost API goes to the TODO as a /ship-feature with those findings as spec input. doctor.sh keeps its measured ui-ux 670 (the one correct figure) until then.
|
||||
|
||||
## Fix plan (r3)
|
||||
1. `hooks/session-start.sh`: delete the plan/budget block (:162-167), the passive-cost block (:169-196, incl. `_plugin_costs` and the `unset _passive_t _budget_pct _budget` line), the 💰 printf (:270) and `TOKEN_WARN` from the final `unset` (:463). Nothing else reads PLAN / PLAN_LABEL / TOKEN_WARN (grep verified).
|
||||
2. `lib/detect-plugins.sh`: delete `detect_plan` and its "Plan detection" section (no caller left; BLK-043's fork-bomb source goes with it); header line 7 drops `detect_plan`.
|
||||
3. `lib/tests/detect-plan.test.sh` → `git mv` to `lib/tests/hook-recursion-guard.test.sh` (Makefile globs `lib/tests/*.test.sh`): delete T1/T2 (detect_plan cases), the `LIB=` line, the maxhome fixture and the `cp … .claude.json` line (only detect_plan needed it); keep T3 (SESSION_START_RUNNING guard) and T4 (child sees guard, no claude calls), green without `.claude.json`; header: the suite guards the hook recursion guard (BLK-043); summary `hook-recursion-guard: %d passed, %d failed`.
|
||||
4. `agents/status-reporter.md`: delete the doctor-grep block (:27-33); prose: the passive cost is not computed here, `make doctor` measures it; output template `Plugins ON: <list> (~<X>t passive — doctor.sh constants; full audit → /plugin-check)` → `Plugins ON: <list> (passive cost: make doctor; full audit → /plugin-check)`; frontmatter description "plugin roster + passive-cost estimate (doctor.sh constants)" → "plugin roster (passive cost: make doctor)".
|
||||
5. `agents/plugin-advisor.md`: no per-plugin token figure left (they were stale: gstack 2750 vs ~445 measured over 3 packs, ui-ux 400 vs 666, context7 is a CLI whose find-docs skill always loads):
|
||||
- drop the `(~400t)` ×3, `(~2750t)`, `(~100t)` parentheticals; context7 `(~200t)` → `(CLI; its find-docs skill always loads)`; `~100t saved if disabled` → `saves its passive tokens if disabled`; :150 "Saves ~3000-5000t" → "Saves passive tokens"; :152 "~3100t saved" → "passive tokens saved"; :243 "~800t base only" → "base only".
|
||||
- recommended-sets table: delete the "Passive cost" column.
|
||||
- COST ESTIMATE template line → `COST ESTIMATE: run make doctor (measured; no per-plugin constants here)`.
|
||||
- The plan-budget WARN (:317) stays (deferred D3; unreachable: plugin-gate never sends PLAN).
|
||||
6. `lib/tests/session-banner.test.sh`: SB9: the SB3 banner (full) has no `💰` line and no `budget` text. SB10 census: hooks/session-start.sh has no `_plugin_costs`, `TOKEN_WARN`, `detect_plan`; lib/detect-plugins.sh has no `detect_plan`; agents/status-reporter.md has no `PLUGIN_TOKENS` and no `~[1-9][0-9-]*t`; agents/plugin-advisor.md has no `~[1-9][0-9-]*t` outside the plan-budget WARN line (`grep -v 'plan budget'`).
|
||||
7. Bookkeeping (orchestrator): BUGS-FOUND G2 FIXED line (hand figures removed; doctor keeps measured 670; measured-cost API in TODO); TODO: /ship-feature "measured passive-cost API" with the round-1/round-2 findings listed; D3 deferred items (plan-budget WARN, "0t passive" pack-design claims); USAGE.md citers :248 :494 :923 for the doc-sync gate.
|
||||
|
||||
## Edge cases
|
||||
- `hook-recursion-guard.test.sh` T3/T4 keep their existing fake HOME (links of ~/.claude/* entries, read-only use), unchanged beyond the deletions.
|
||||
- Advisor still fails closed on a missing PROBE REPORT field: the field list is unchanged (no COSTS field in r3).
|
||||
|
||||
## In-force
|
||||
LRN-088 (re-measure after catalog change), LRN-274 (pipefail-safe lib functions), BLK-043 (detect_plan fork bomb; removal ends it; claude stub in hook tests), BDR-100 (patch every citer), BDR-125 (delete what the change obsoletes). Foreign-code style.
|
||||
Files (r3): hooks/session-start.sh, lib/detect-plugins.sh, lib/tests/detect-plan.test.sh → hook-recursion-guard.test.sh, agents/status-reporter.md, agents/plugin-advisor.md, lib/tests/session-banner.test.sh.
|
||||
@@ -69,6 +69,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
||||
- `rules/default-language.md`: its content is `lib/architecture-defaults.md` § Default language.
|
||||
- The five `effort-low` … `effort-max` skills, `lib/effort-pins.txt`, `lib/effort-pins.sh` and `lib/model-check.sh`, with their tests and the effort-pin re-apply steps of `install-plugins.sh` and `update-all.sh`. The model-router rows replace them. A typed `/effort-<level>` no longer exists: use `ultrathink` or `/route effort=max`. Breaking: the next release is 3.0.0.
|
||||
- `skills-disabled/`, `lib/toggle-external.sh`, `.profile`, `.active-profile` and `make profile-reset`. `profile.sh enable higgsfield` replaces `toggle-external.sh`. Machine steps: MIGRATION.md, "Profiles and packs".
|
||||
- The session banner's 💰 passive-cost row and its per-plan budget (Pro 11000, Max 20000 tokens), with the hand-copied per-plugin constants behind it (gstack 2750, ui-ux-pro-max 400, graphify 300, context7 200, plugin-dev 100) and `detect_plan` in `lib/detect-plugins.sh`, left without a caller. The constants went stale at the 2026-09-28 skill-catalog prune, which fixed only `doctor.sh`. `make doctor` is now the one place that measures the passive cost: the plugin advisor's `COST ESTIMATE` and the `/status` `Plugins ON:` line point to it and quote no per-plugin figure. `lib/tests/detect-plan.test.sh` becomes `lib/tests/hook-recursion-guard.test.sh` (the BLK-043 re-entry guard).
|
||||
|
||||
### Fixed
|
||||
- `/guardrails` and the interviewer cite the secure-by-default, Supabase, cloud-function and a11y rules by their absolute `~/.claude/rules/<name>.md` path; run from a project repo, the bare `rules/<name>.md` path resolved against that project and missed the rule files.
|
||||
|
||||
@@ -245,7 +245,7 @@ Hotfix/quick fix → tout OFF (skills superpowers vendorisés, toujours
|
||||
|
||||
## Patterns de workflow
|
||||
|
||||
> **Budget Pro (~11k tokens/5h) :** un `/init-project` complet consomme 3000-5000t — laissant 6000-8000t pour les steps suivants. Adapter le choix de plugins actifs en conséquence. Les tokens sont indiqués à titre indicatif — varient selon la taille du projet et les plugins actifs.
|
||||
> **Coût indicatif :** un `/init-project` complet consomme 3000-5000t. Le coût passif des plugins actifs se mesure avec `make doctor`. Les tokens sont indiqués à titre indicatif et varient selon la taille du projet et les plugins actifs.
|
||||
|
||||
### Pattern A — Nouveau projet court (≤1 session) · ~3000-5000t
|
||||
|
||||
|
||||
+22
-22
@@ -104,7 +104,7 @@ PROFILE: [active skill profile — name + match%, or "<name> (default — not ap
|
||||
SIGNALS: [detected signals]
|
||||
COMPLEXITY: <score>% — <simple|moderate|complex|enterprise>
|
||||
PLAN: <Max|Pro|Free (echoed from REQUEST) | unknown (not provided)> (budget: ~<N>t | n/a)
|
||||
COST ESTIMATE: ~Xt passive tokens (all active plugins combined)
|
||||
COST ESTIMATE: run make doctor (measured; no per-plugin constants here)
|
||||
|
||||
RECOMMENDATIONS:
|
||||
✅ KEEP : [plugin] — [reason]
|
||||
@@ -147,9 +147,9 @@ ACTION REQUIRED? YES / NO
|
||||
| `multi-session` | gsd v2 CLI | — | Run `gsd` in terminal, not CC plugin |
|
||||
| `fast-libs` | context7 | — | Doc freshness critical |
|
||||
| `multi-agent` + `complex-arch` | gsd v2 CLI | — | GSD v2 preferred for multi-session coordination |
|
||||
| `simple` / single-session | — | gsd, gstack, ui-ux-pro-max | Saves ~3000-5000t |
|
||||
| `simple` / single-session | — | gsd, gstack, ui-ux-pro-max | Saves passive tokens |
|
||||
| `embedded` / firmware | — | all toggles (superpowers skills vendored, always on) | workflow: /analyze → /hotfix or /bugfix or /ship-feature |
|
||||
| backend/lib/CLI only | — | ui-ux-pro-max, gstack | ~3100t saved |
|
||||
| backend/lib/CLI only | — | ui-ux-pro-max, gstack | passive tokens saved |
|
||||
| small project / hotfix | — | gstack, gsd | Use /hotfix, /bugfix, or /feat |
|
||||
|
||||
**GSD v2 note:** `gsd-pi` is a standalone CLI (Pi SDK), not a Claude Code plugin. Zero passive token cost in CC sessions. Recommend when: feature > 1 day, multiple isolated context windows needed, crash recovery, cost tracking, or parallel workers. Usage: `gsd` in terminal → `/gsd auto`.
|
||||
@@ -190,17 +190,17 @@ When the plugin-advisor detects a `simple` or `hotfix` signal, suggest the appro
|
||||
|
||||
### Recommended sets by project type
|
||||
|
||||
| Project type | Plugins ON | OFF | Passive cost |
|
||||
|---|---|---|---|
|
||||
| Backend API / microservice | (superpowers skills always on), context7 (if fast libs) | ui-ux-pro-max, gstack | ~0t |
|
||||
| Frontend SPA / SSR | (superpowers skills always on), ui-ux-pro-max, impeccable, design-motion-principles, context7 | gstack | ~600t |
|
||||
| Full-stack SaaS | (superpowers skills always on), gstack, ui-ux-pro-max, impeccable, design-motion-principles, context7 | — | ~3400t |
|
||||
| CLI tool / library | (superpowers skills always on) | all toggles | ~0t |
|
||||
| Multi-session large feature | (superpowers skills always on) + gsd v2 CLI (external) | — | ~0t CC |
|
||||
| Quick fix / hotfix | (superpowers skills always on) | all toggles | ~0t |
|
||||
| Design system / component lib | (superpowers skills always on), ui-ux-pro-max, impeccable, design-motion-principles | gstack, gsd | ~400t |
|
||||
| Fast-evolving libs (Next.js etc.) | (superpowers skills always on), context7 | — | ~200t |
|
||||
| Enterprise multi-agent orchestration | (superpowers skills always on) + gsd v2 (external) | plugin-dev | ~0t CC |
|
||||
| Project type | Plugins ON | OFF |
|
||||
|---|---|---|
|
||||
| Backend API / microservice | (superpowers skills always on), context7 (if fast libs) | ui-ux-pro-max, gstack |
|
||||
| Frontend SPA / SSR | (superpowers skills always on), ui-ux-pro-max, impeccable, design-motion-principles, context7 | gstack |
|
||||
| Full-stack SaaS | (superpowers skills always on), gstack, ui-ux-pro-max, impeccable, design-motion-principles, context7 | — |
|
||||
| CLI tool / library | (superpowers skills always on) | all toggles |
|
||||
| Multi-session large feature | (superpowers skills always on) + gsd v2 CLI (external) | — |
|
||||
| Quick fix / hotfix | (superpowers skills always on) | all toggles |
|
||||
| Design system / component lib | (superpowers skills always on), ui-ux-pro-max, impeccable, design-motion-principles | gstack, gsd |
|
||||
| Fast-evolving libs (Next.js etc.) | (superpowers skills always on), context7 | — |
|
||||
| Enterprise multi-agent orchestration | (superpowers skills always on) + gsd v2 (external) | plugin-dev |
|
||||
|
||||
> rtk is always on at 0 context tokens; security-guidance is always on and
|
||||
> costs quota out of band (LLM reviews), not context — both omitted from
|
||||
@@ -212,7 +212,7 @@ When the plugin-advisor detects a `simple` or `hotfix` signal, suggest the appro
|
||||
RULE: IF "mobile" signal (React Native/Expo/Flutter detected):
|
||||
→ gstack OFF — no browser QA on mobile
|
||||
→ Docker NOT relevant — no server-side containerization for mobile
|
||||
→ ui-ux-pro-max OPTIONAL (~400t) — only if design system complexity is high
|
||||
→ ui-ux-pro-max OPTIONAL — only if design system complexity is high
|
||||
|
||||
RULE: IF "monorepo" signal detected:
|
||||
→ scan each top-level package individually for frontend/deploy/fast-libs signals
|
||||
@@ -222,25 +222,25 @@ RULE: IF "monorepo" signal detected:
|
||||
→ passive cost estimate = highest-cost package profile (other packages add nothing)
|
||||
|
||||
RULE: IF "frontend" signal OR .tsx/.jsx count > 0:
|
||||
→ ui-ux-pro-max ON if "design-system" signal (~400t)
|
||||
→ ui-ux-pro-max ON if "design-system" signal
|
||||
→ impeccable ON (external skill, 0t passive — ~/.claude/skills/pack-design/skills/impeccable)
|
||||
→ design-motion-principles ON if anim-lib-installed or description mentions animation/motion (external, 0t passive)
|
||||
|
||||
RULE: IF "deploy" AND "browser-qa" signals:
|
||||
→ gstack ON (~2750t) — full-product workflow
|
||||
→ gstack ON — full-product workflow
|
||||
|
||||
RULE: IF "multi-session" OR multi-day feature:
|
||||
→ Recommend gsd v2 CLI: npm install -g gsd-pi → gsd → /gsd auto
|
||||
→ Zero passive CC token cost
|
||||
|
||||
RULE: IF "fast-libs" (Next.js/React 18+/Prisma/Supabase/Drizzle):
|
||||
→ context7 ON (~200t)
|
||||
→ context7 ON (CLI; its find-docs skill always loads)
|
||||
|
||||
RULE: IF "multi-agent" AND "complex-arch":
|
||||
→ gsd v2 CLI recommended (0t passive, multi-session coordination)
|
||||
|
||||
RULE: IF "simple" OR "hotfix":
|
||||
→ Disable all toggles. ~800t base only.
|
||||
→ Disable all toggles, base only.
|
||||
|
||||
RULE: IF "embedded" signal (firmware, bare-metal, microcontroller, or Makefile+C without Node/Rust/Go):
|
||||
→ Disable ALL toggles including gstack, context7, plugin-dev
|
||||
@@ -252,11 +252,11 @@ RULE: IF "embedded" signal (firmware, bare-metal, microcontroller, or Makefile+C
|
||||
→ NOTE: print "embedded project detected — minimal plugin footprint recommended"
|
||||
|
||||
RULE: IF plugin-dev ON AND no `skill-creation` signal detected:
|
||||
→ WARN: plugin-dev active but no skill-creation signal (~100t saved if disabled)
|
||||
→ WARN: plugin-dev active but no skill-creation signal (saves its passive tokens if disabled)
|
||||
→ Disable unless you're actively building custom plugins or skills
|
||||
|
||||
RULE: IF `skill-creation` signal:
|
||||
→ plugin-dev ON (~100t)
|
||||
→ plugin-dev ON
|
||||
→ superpowers skills (vendored, always on): used for skill scaffolding (writing-skills)
|
||||
|
||||
RULE: IF `browser-qa` signal (e2e tests, Playwright/Cypress/Puppeteer in deps):
|
||||
@@ -264,7 +264,7 @@ RULE: IF `browser-qa` signal (e2e tests, Playwright/Cypress/Puppeteer in deps):
|
||||
→ context7 OPTIONAL (depends on framework version)
|
||||
|
||||
RULE: IF `design-system` signal (tokens, theme files, Storybook present):
|
||||
→ ui-ux-pro-max ON (~400t)
|
||||
→ ui-ux-pro-max ON
|
||||
→ impeccable ON (external skill, 0t passive)
|
||||
→ design-motion-principles ON (external skill, 0t passive)
|
||||
→ WARN if all three OFF with this signal: significant design gap
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: status-reporter
|
||||
description: Read-only project-status engine — dispatched by /status. Collects plugin roster + passive-cost estimate (doctor.sh constants), git state, build/tests, GSD milestone into one snapshot.
|
||||
description: Read-only project-status engine — dispatched by /status. Collects plugin roster (passive cost via make doctor), git state, build/tests, GSD milestone into one snapshot.
|
||||
tools: Read, Bash, Glob, Grep
|
||||
model: haiku
|
||||
effort: low
|
||||
@@ -25,15 +25,9 @@ cat ~/.claude/lib/../version.txt 2>/dev/null || echo "unknown" # lib symlink re
|
||||
bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current --plain 2>/dev/null | grep -E '^(profile|pack-[a-z0-9-]+)=' || echo "profile-unavailable"
|
||||
command -v rtk &>/dev/null && echo "rtk: installed" || echo "rtk: missing"
|
||||
command -v gsd &>/dev/null && gsd --version 2>/dev/null | head -1 || echo "gsd: not installed"
|
||||
|
||||
# Passive token cost — source of truth: doctor.sh's constants block
|
||||
# (PLUGIN_TOKENS + <n> per detect_* line). Read it, sum ONLY the plugins
|
||||
# found active above. Never invent a number outside these constants.
|
||||
grep -E 'PLUGIN_TOKENS \+ [0-9]+' "$(readlink -f "$HOME/.claude/lib")/../doctor.sh" 2>/dev/null
|
||||
# grep empty (doctor.sh missing/moved) → report the plugin count only and
|
||||
# defer cost to /plugin-check.
|
||||
```
|
||||
|
||||
The passive token cost is not computed here: `make doctor` measures it.
|
||||
`~/.claude/plugins/cache` = installed, not active. `Plugins ON:` = rtk (if present) + the names printed by `list_on_plugins` (part before `@`) + the `pack-*=on` packs.
|
||||
Check `~/.claude.json` for active MCP servers.
|
||||
|
||||
@@ -141,7 +135,7 @@ PROJECT STATUS
|
||||
|
||||
CONFIG
|
||||
Version : v<N>
|
||||
Plugins ON: <list> (~<X>t passive — doctor.sh constants; full audit → /plugin-check)
|
||||
Plugins ON: <list> (passive cost: make doctor; full audit → /plugin-check)
|
||||
GSD v2 : installed / not installed
|
||||
|
||||
PROJECT
|
||||
|
||||
+1
-38
@@ -159,42 +159,6 @@ if [ -n "${CLAUDE_CODE_EFFORT_LEVEL:-}" ]; then
|
||||
EFFORT_WARN="⚠️ CLAUDE_CODE_EFFORT_LEVEL=${CLAUDE_CODE_EFFORT_LEVEL} set: skill/agent effort pins ignored"
|
||||
fi
|
||||
|
||||
# Detect plan and set passive token budget
|
||||
PLAN=$(detect_plan 2>/dev/null || echo "pro")
|
||||
case "$PLAN" in
|
||||
max) _budget=20000; PLAN_LABEL="Max" ;;
|
||||
pro) _budget=11000; PLAN_LABEL="Pro" ;;
|
||||
*) _budget=11000; PLAN_LABEL="Pro" ;;
|
||||
esac
|
||||
|
||||
# Quick passive token cost estimate
|
||||
# Only count plugins that are ACTIVE (detected as ON), not just installed
|
||||
# superpowers dropped 2026-09-28 (tier 2 of the skill-catalog prune): its
|
||||
# 7 vendored skills are counted by the skill catalog, not a plugin cost.
|
||||
_passive_t=0
|
||||
|
||||
# Token costs for toggle plugins — map display name to cost
|
||||
declare -A _plugin_costs=(
|
||||
[gstack]=2750
|
||||
[ui-ux-pro-max]=400
|
||||
[plugin-dev]=100
|
||||
[context7]=200
|
||||
[graphify]=300
|
||||
)
|
||||
for _p in "${TOGGLE_ACTIVE[@]}"; do
|
||||
_cost="${_plugin_costs[$_p]:-0}"
|
||||
_passive_t=$((_passive_t + _cost))
|
||||
done
|
||||
_budget_pct=$((_passive_t * 100 / _budget))
|
||||
if [ "$_budget_pct" -gt 50 ]; then
|
||||
TOKEN_WARN="⚠️ ~${_passive_t}t passif (${_budget_pct}% budget $PLAN_LABEL)"
|
||||
elif [ "$_budget_pct" -gt 25 ]; then
|
||||
TOKEN_WARN="~${_passive_t}t passif (${_budget_pct}% budget $PLAN_LABEL)"
|
||||
else
|
||||
TOKEN_WARN=""
|
||||
fi
|
||||
unset _passive_t _budget_pct _budget
|
||||
|
||||
echo ""
|
||||
echo "┌─ Claude Code config ──────────────────────────────────┐"
|
||||
# "ALWAYS ON" row — actual state, not hardcoded. RTK is a binary on PATH;
|
||||
@@ -267,7 +231,6 @@ else
|
||||
fi
|
||||
unset _active_count _inactive_count
|
||||
printf "│ 🖥️ CLI : %-40s│\n" "$GSD_STATUS"
|
||||
[ -n "$TOKEN_WARN" ] && printf "│ 💰 %-44s│\n" "${TOKEN_WARN:0:44}"
|
||||
printf "│ 📦 v%-45s│\n" "$CONFIG_VERSION"
|
||||
if [ -n "$GF_REFRESHED" ]; then
|
||||
_gf_line="hooks refreshed: $GF_REFRESHED → commit .githooks/"
|
||||
@@ -460,4 +423,4 @@ fi
|
||||
unset _ss_digest
|
||||
|
||||
echo ""
|
||||
unset TOKEN_WARN PROFILE_PLAIN
|
||||
unset PROFILE_PLAIN
|
||||
+1
-25
@@ -4,7 +4,7 @@
|
||||
# Sourced by: session-start.sh, doctor.sh, agents/status-reporter.md
|
||||
#
|
||||
# detect_* return 0 (detected) or 1 (not detected), silently — callers
|
||||
# handle messaging. detect_plan and list_on_plugins print to stdout.
|
||||
# handle messaging. list_on_plugins prints to stdout.
|
||||
# ============================================================
|
||||
|
||||
# --- Always-on plugins ---
|
||||
@@ -86,27 +86,3 @@ detect_graphifyy() {
|
||||
# Graphifyy — codebase knowledge graph, installed via pipx
|
||||
command -v graphify &>/dev/null
|
||||
}
|
||||
|
||||
|
||||
# --- Plan detection ---
|
||||
|
||||
detect_plan() {
|
||||
# Detect Claude plan: max or pro.
|
||||
# Never call the `claude` CLI here: it starts a session whose
|
||||
# SessionStart hook calls detect_plan again (BLK-043).
|
||||
# Checks ~/.claude.json for model access hints.
|
||||
# Returns plan name on stdout, always exits 0.
|
||||
local claude_json="$HOME/.claude.json"
|
||||
if [ -f "$claude_json" ]; then
|
||||
# Max plan: has opus model access or max flag
|
||||
if grep -q '"planType".*"max"' "$claude_json" 2>/dev/null; then
|
||||
echo "max"; return 0
|
||||
fi
|
||||
# Check cached features for max indicators
|
||||
if grep -q '"tengu_cobalt_compass": true' "$claude_json" 2>/dev/null \
|
||||
&& grep -q '"tengu_harbor": true' "$claude_json" 2>/dev/null; then
|
||||
echo "max"; return 0
|
||||
fi
|
||||
fi
|
||||
echo "pro"
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib/tests/detect-plan.test.sh
|
||||
# Regression for BLK-043: detect_plan must never call the claude CLI
|
||||
# (a hook-launched claude re-enters session-start.sh: fork bomb).
|
||||
# lib/tests/hook-recursion-guard.test.sh
|
||||
# Regression for BLK-043: session-start.sh must guard against re-entry
|
||||
# and never call the claude CLI (a hook-launched claude re-enters the
|
||||
# hook: fork bomb).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
LIB="${DETECT_PLUGINS_LIB:-$ROOT/lib/detect-plugins.sh}"
|
||||
HOOK="$ROOT/hooks/session-start.sh"
|
||||
WORK=$(mktemp -d) || exit 1
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
@@ -17,27 +17,11 @@ check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||
. "$ROOT/lib/tests/claude-stub.sh" || exit 1
|
||||
claude_stub_install "$WORK"
|
||||
|
||||
# detect_plan, no .claude.json: pro, no claude call.
|
||||
mkdir -p "$WORK/empty"
|
||||
out=$(HOME="$WORK/empty" bash -c 'source "$1"; detect_plan' _ "$LIB")
|
||||
check T1-no-json-plan "$out" pro
|
||||
check T1-no-json-calls "$(claude_stub_calls)" 0
|
||||
|
||||
# detect_plan, max markers: max, no claude call.
|
||||
mkdir -p "$WORK/maxhome"
|
||||
printf '{"tengu_cobalt_compass": true, "tengu_harbor": true}\n' \
|
||||
>"$WORK/maxhome/.claude.json"
|
||||
: >"$CLAUDE_LOG"
|
||||
out=$(HOME="$WORK/maxhome" bash -c 'source "$1"; detect_plan' _ "$LIB")
|
||||
check T2-max-plan "$out" max
|
||||
check T2-max-calls "$(claude_stub_calls)" 0
|
||||
|
||||
# Hook HOME: real ~/.claude entries + max fixture (no fallback needed).
|
||||
# Hook HOME: real ~/.claude entries.
|
||||
mkdir -p "$WORK/hookhome/.claude" "$WORK/proj"
|
||||
for e in "$HOME"/.claude/*; do
|
||||
ln -s "$e" "$WORK/hookhome/.claude/$(basename "$e")"
|
||||
done
|
||||
cp "$WORK/maxhome/.claude.json" "$WORK/hookhome/.claude.json"
|
||||
|
||||
# Guard: hook exits 0 silently when already running.
|
||||
out=$(cd "$WORK/proj" && HOME="$WORK/hookhome" SESSION_START_RUNNING=1 \
|
||||
@@ -62,5 +46,5 @@ chmod +x "$WORK/stub/git"
|
||||
check T4-child-sees-guard "$(head -1 "$GIT_LOG")" 1
|
||||
check T4-hook-no-claude-calls "$(claude_stub_calls)" 0
|
||||
|
||||
printf 'detect-plan: %d passed, %d failed\n' "$pass" "$fail"
|
||||
printf 'hook-recursion-guard: %d passed, %d failed\n' "$pass" "$fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
@@ -89,6 +89,10 @@ check SB3-toggle-on-uiux "$(has "$(row '🟢 ON' "$out")" ui-ux-pro-max)" 1
|
||||
ok="$(row '✅ ON' "$out")"
|
||||
check SB3-onrow-no-pr-review "$(has "$ok" pr-review-toolkit)" 0
|
||||
|
||||
# SB9: no passive-cost row and no plan budget in the banner
|
||||
check SB9-no-cost-row "$(has "$out" 💰)" 0
|
||||
check SB9-no-budget "$(has "$out" budget)" 0
|
||||
|
||||
# uiux <home> <proj>: exit status of detect_uiux_pro_max, PROFILE_PLAIN unset
|
||||
uiux() {
|
||||
(cd "$WORK/$2" && unset PROFILE_PLAIN && HOME="$WORK/$1" bash -c \
|
||||
@@ -126,5 +130,19 @@ check SB7-empty-list-rtk-only "$ao" rtk
|
||||
# SB8: no hook run of this suite called the claude CLI (BLK-043)
|
||||
check SB8-no-claude-calls "$(claude_stub_calls)" 0
|
||||
|
||||
# SB10: no hand-copied passive-cost figure or dead plan path left
|
||||
# gone <file> <regex> [filter]: 1 when no line (after the filter) matches
|
||||
gone() {
|
||||
if grep -v "${3:-^\$}" "$ROOT/$1" | grep -qE -- "$2"; then echo 0
|
||||
else echo 1; fi
|
||||
}
|
||||
check SB10-hook-costs "$(gone hooks/session-start.sh \
|
||||
'_plugin_costs|TOKEN_WARN|detect_plan')" 1
|
||||
check SB10-lib-detect-plan "$(gone lib/detect-plugins.sh detect_plan)" 1
|
||||
check SB10-reporter-const "$(gone agents/status-reporter.md \
|
||||
'PLUGIN_TOKENS|~[1-9][0-9-]*t')" 1
|
||||
check SB10-advisor-figures "$(gone agents/plugin-advisor.md \
|
||||
'~[1-9][0-9-]*t' 'plan budget')" 1
|
||||
|
||||
printf 'session-banner: %d passed, %d failed\n' "$pass" "$fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
Reference in new issue
Block a user