chore(memory): G2 fixed (split), BLK-047, LRN-275, measured-cost feature in TODO
This commit is contained in:
1 parent
9777a4795d
commit
176023bf5d
7 files changed
+86
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.
|
||||
Reference in new issue
Block a user