chore(memory): phase 5 profiles+packs — BDR-134, LRN-248..253, BLK-039/040, BLK-021 resolved, EVAL-054, journal, TODO tick
This commit is contained in:
1 parent
ebfe2159b8
commit
3e021b2564
6 files changed
+65
-1
No files matched your search
@@ -232,6 +232,7 @@ rules:
|
||||
- **Recurred same day**: this session's shell died the same way mid-G8 (BDR-095 amendment) while the 5.9 GB still sat there; recovered the moment the user deleted the dir. Mechanism now established, not inferred: stock `/usr/lib/systemd/system/tmp.mount` mounts /tmp with `x-systemd.graceful-option=usrquota` (no override, no fstab line on this machine) and systemd caps each user at 80% of the tmpfs → 0.8 × 7.4 GB = 5.9 GB, the exact volume observed. One quota for every session AND every sub-agent of the uid: multi-session is not the cause, the shared cap is.
|
||||
- **Durable fix**: (1) launch claude with `TMPDIR=$HOME/.cache/claude-tmp` (in `~/.bashrc` `dtach_claude()`, before `exec claude`; `mkdir -p` it) → Claude Code's scratchpad, tool outputs, `mktemp` and npm staging all leave the tmpfs; children inherit. (2) `~/.config/user-tmpfiles.d/claude-tmp.conf` with `e %h/.cache/claude-tmp - - - 3d` + the user `systemd-tmpfiles-clean.timer` so dead-session dirs age out. (3) `make doctor` "Scratchpad" section warns while TMPDIR sits on a quota'd tmpfs. Probe rule unchanged: HOMEs with npm payloads under `~/.cache/<probe>/`.
|
||||
- **Status**: cause established; open until the launcher exports TMPDIR (user's .bashrc, hand-managed). Links [[BDR-094]], [[BDR-095]], [[LRN-159]].
|
||||
- **Status (2026-11-02)**: resolved 2026-11-02: lib/cc.sh exports TMPDIR=$HOME/.cache/claude-tmp for every cc session (phase 5)
|
||||
|
||||
## BLK-022 — `hooks/guard-bash.sh` withheld by the safety classifier; executable spec shipped instead — 2026-09-22
|
||||
- **Friction**: layer C item G2 (PreToolUse Bash guard: whole-command scan incl. nested `bash -c`, `docker compose run … lftp`, scripts the command runs; exit 2 + reason + `logger` trace; fail-closed without jq). The response carrying the hook body was stopped by a safety classifier mid-write; content withheld, instruction not to regenerate it.
|
||||
@@ -344,3 +345,15 @@ rules:
|
||||
- **Measured**: 13 repos, 4 v1 closures without a labelled leading closed word: orbistep BLK-021 (really open), BLK-026 (prose addendum, really resolved), BLK-030 (mixed), bchanot-cv BLK-001 (strict already resolved, no effect). No lexical rule decides prose: BLK-021 and BLK-026 same shape, opposite truth.
|
||||
- **Solution**: /bugfix bugfix/memory-upgrade-prose-closure: repair only from a `Status`/`Statut` label whose leading word closes; else refuse file (rc 2), name ID + v1 line + remedy `memory.sh status`. Dedupe IDs. Committed repos audited clean; orbistep + zenquality redone after fix.
|
||||
- **Status (2026-10-31)**: resolved 2dae528: repair writes only a single closed Status word, prose/mixed refused and named, diff captured before inserts, one upgrade line per entry; orbistep + zenquality redone (144505f, b7edb9c)
|
||||
|
||||
## BLK-039 — Nested heredoc executed plan text: settings.json committed, user's stash popped [resolved] (2026-11-02)
|
||||
- **Friction**: a Bash call holding a python heredoc that itself contained `<<'EOF'` blocks: the inner `EOF` closed the outer heredoc; the rest of the plan text ran as shell commands → `git stash push settings.json` (silently failed), `git commit` of settings.json WITH the UI writes (theme, switchModelsOnFlag), auto-pushed; `git stash pop` popped the USER's own stash `wip: settings+routing dirty (user)` (conflict, entry kept).
|
||||
- **Real cause**: heredoc nesting with the same delimiter; `rm -r`-class rules did not matter, the damage was git state.
|
||||
- **Solution**: tree restored (`git reset -q`, checkout of the three stash-touched files to HEAD, stash-brought spec removed), commit dropped with `git reset --soft HEAD~1` + `git push --force-with-lease=<branch>:<sha>` (user approved), user's stash untouched. Rule: plan/doc text via Write/Edit, never heredoc-in-heredoc; never `git stash pop` on a machine with the user's own stashes; settings.json only through the index recipe (LRN-253).
|
||||
- **Status**: resolved 2026-11-01.
|
||||
|
||||
## BLK-040 — Permission rules and auto-mode classifier refuse destructive-shaped compound calls and dispatches [resolved] (2026-11-02)
|
||||
- **Friction**: phase 5 execution: the permission rules refused a compound Bash call holding a `trap` with `rm -f`/`rmdir` (Task 1 canary), a 53-name `rm … && rmdir && rm .active-profile` chain, and `rmdir` alone; the auto-mode classifier refused the whole Task 2 dispatch because its brief described removing ~70 symlinks, moving impeccable and rewriting settings.json.
|
||||
- **Real cause**: destructive-shaped text in one call or one brief; the classifier judges the dispatch prompt, the rules judge each command.
|
||||
- **Solution**: split build steps (implementer) from state steps (main loop, after the user's explicit approval); one `rm` of literal names per call; `mv` to the scratch dir instead of `rmdir`/`rm -r`; never retry a refused command through a wrapper. Cost: three extra user gates, no data loss.
|
||||
- **Status**: resolved 2026-11-02.
|
||||
@@ -474,6 +474,7 @@ rules:
|
||||
- **Caveats**: the symlink form (`skills/<name> -> skills-external/gstack/<name>`) differs from what gstack `./setup` would create (real dir + symlinked SKILL.md) — fine here because `./setup` never populates `skills/` in this layout, so no mixed-form collision. Browse RUNTIME still needs the built binary + sandbox env ([[BDR-029]]) — on-demand makes the skill DISCOVERABLE, not the browser functional on an unsupported OS. The old "try: bash link.sh" message was wrong (link.sh never creates gstack skills) → replaced with submodule-aware messages.
|
||||
- **Alternatives rejected**: full gstack integration (make `./setup` install into `skills/`) — user picked option 1, too invasive/version-fragile; leave `full` broken with honest 1-line warning — worse UX; pre-symlink all gstack at install — violates OFF-by-default context policy.
|
||||
- **Reference**: `lib/profile.sh` `GSTACK_SRC` + `enable_skill` gstack branch. Verified: `set full` → 0 missing, 35 on-demand; `minimal`↔`full` cycle re-parks/restores; git clean (gstack symlinks gitignored, [[LRN-025]]). Linked to [[LRN-042]], [[LRN-022]], [[BDR-018]] (gstack on/off verb).
|
||||
- **Status (2026-11-02)**: superseded by BDR-134
|
||||
|
||||
---
|
||||
|
||||
@@ -1459,3 +1460,13 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
**Alternatives**: ignore negation (keeps false closures); line-scope negation (`resolved, not open` would read none: wrong); NLP (no).
|
||||
|
||||
**Consequences**: real-data replay 14 repos → 1 move (robin_petier EVAL-005 accepted → keep). mawk run in T17 guards BWK-class awk.
|
||||
|
||||
## BDR-134 — Phase 5: packs are skills-dir plugins, profiles are settings fragments, nothing global (2026-11-02)
|
||||
- **Context**: one `~/.claude` serves every project and conversation. Old mechanism global: `skills/` ↔ `skills-disabled/` symlink moves + user-scope `claude plugin enable|disable` + `.active-profile`. One project's switch changed every open session.
|
||||
- **Decision**: heavy skill groups = skills-dir plugins `skills/pack-<n>/` (manifest + tracked relative symlinks into `skills-external/`, 4 real dirs moved). 9 packs: design, scroll3d, seo, web-validate, gstack-dev, gstack-browser, gstack-design, higgsfield (OFF), extras (OFF). Profiles = literal settings fragments `lib/profiles/<n>.json` (`enabledPlugins` explicit for every pack + managed plugin, `deniedMcpServers` both higgsfield connectors on minimal/dev/seo/qa/audit, optional `model`); 9 profiles (backend, web-full dropped: byte-identical to dev, full). Per project `profile.sh set` merges into `.claude/settings.local.json`; per conversation `cc <name> <profile>` = `claude --settings`. `profile.sh current --plain` single truth for gate, hooks, statusline, advisor. No profile = manifest defaults = full. Listing budget `SLASH_COMMAND_TOOL_CHAR_BUDGET=50000` (0 name-only on full, +4.5k tokens est.).
|
||||
- **Rationale**: measured 2026-11-01 (CLI 2.1.316): pack skills listed once as `pack:skill`, both names invoke; `--settings` false beats local true; `/reload-plugins` reloads a pack mid-session from a local edit but never re-reads a `--settings` file (frozen conversation → relaunch); connectors load under `-p`, denied per project by `serverName`, union across files.
|
||||
- **Alternatives rejected**: keep symlink toggling (global, races between sessions); pack `.mcp.json` for higgsfield (duplicates the claude.ai connector, needs interactive OAuth); per-request confirmation of the gate (gate reads settings state, not files).
|
||||
- **Supersedes**: BDR-030 (gstack via symlinks), BDR-079 (`set` symmetric on externals/MCPs), BDR-101 mechanism (full stays the policy). **Amends**: BDR-024/025 (`show --plain` → `current --plain`), BDR-109 (`higgsfield-websites` lives in pack-higgsfield, ON in `max` only; `profile.sh enable higgsfield` replaces both toggles; npm CLI unchanged).
|
||||
- **Accepted risks**: `cc.sh` keeps `set -a; . ~/.claude/.env` (all secrets in the claude env, as `dtach_claude` did); `deniedMcpServers` union = `cc x web` on a `dev` project keeps the connectors denied (`set web` in the project fixes it).
|
||||
- **Branch**: feature/phase5-profiles-packs; spec docs/superpowers/specs/2026-11-01-phase5-profiles-packs-design.md; contract .claude/tasks/contracts/2026-11-01-phase5-profiles-packs-1300.md.
|
||||
Supersedes [[BDR-030]].
|
||||
@@ -419,3 +419,10 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
||||
- **Method**: 3-lens plan challenge + confirmation pass, per-task reviews, final opus/xhigh whole-branch review, GATE 0 oracles (10 runnable, c1-*.sh positive-controlled before work), fresh verifier, security gate.
|
||||
- **Anomalies**: challenge found 4 MAJOR (c1-readers red mid-Task 3, worktree vs in place, finish blocked by user settings hunks, contract out of sync with r2); final review found the new-file Write gap (I1) everybody missed; verifier 1st run died on Fable credits (429), retry pinned opus; 2nd run ECARTS(5) all human micro-gate items (approved text not on disk, transient docs out of scope, 2 SC2016 waivers); every per-task review clean first pass.
|
||||
- **Action**: keep oracles + positive control before dispatch; brief reviewers on new-file Write semantics for path rules; record gate texts on disk (contract) so the verifier can match them.
|
||||
|
||||
## EVAL-054 — Three-lens plan challenge + confirmation caught 5 BLOCKERs before execution (phase 5) (2026-11-02)
|
||||
- **Check**: plan r1 (2060 lines) attacked by three blind opus challengers + one confirmation pass before execution.
|
||||
- **Method**: challenge-plan.md; lenses correctness / robustness / simplicity; r2 rewritten; confirmation on r2.
|
||||
- **Result**: r1 FATAL(11)/FATAL(10)/CONCERNS(5): BLOCKER = plan written on a stale tree (profile backend live); 30 jq per statusline refresh; settings.json procedure that would have discarded user writes; test precedence inverted; doctor abort under pipefail; worktree incompatibility. Confirmation on r2: 2 more BLOCKERs (keep list dropped the tracked `skills/model-router` link; census matched itself). All fixed before Task 1. Execution then needed 4 fix rounds (gates/reviews), none on those aspects.
|
||||
- **Anomalies**: the simplicity lens duplicated two robustness findings; the confirmation pass still found BLOCKERs, so one pass is the floor, not the ceiling.
|
||||
- **Action**: keep the 3+1 shape for plans over ~1000 lines; add "live state verified at Task 0" to the plan template.
|
||||
@@ -681,3 +681,6 @@ rules:
|
||||
## 2026-11-01
|
||||
- memory-v2-minors /feat shipped (e4fb8f7 + 48ade8f): negated status words, dead empty steal, body `## ` refused, blob rc 1/2, rc 6 names dropped partial stages, reflow. Verifier CONFORME, security PASS, replay 14 repos = 1 expected move. Docs synced. Next: doc half, then phase 5 spikes.
|
||||
- memory-v2-minors-docs /feat shipped (dfbc8a7): § WRITE says every verb takes -C and --body-file absolute; tour/deploy/audit-delta point at § WRITE; evals template Later status line. Verifier CONFORME, security PASS. Phase 4a minors fully closed; MIGRATION.md:209 parked. Next: phase 5 spikes.
|
||||
|
||||
## 2026-11-02
|
||||
- phase 5 profiles+packs shipped on feature/phase5-profiles-packs (13 tasks SDD, 3-lens challenge, gates MET/CONFORME/PASS after 3 passes): 9 packs, 9 profile fragments, profile.sh one-jq current --plain, cc <name> [profile], census; BDR-134, LRN-248..253, BLK-039/040, EVAL-054; TODO: router ask-before-Fable queued
|
||||
@@ -1881,3 +1881,33 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
**Pattern**: awk `match()` sets globals `RSTART`/`RLENGTH`; shared helper calling it clobbers caller's values. Take `substr(line, RSTART)` BEFORE calling any parser helper; audit every `RSTART` reader in programs embedding the shared awk block.
|
||||
|
||||
**Application**: any `_MEM_AWK` change touching match(); same for `$0`, `NF` side effects of `sub()`/`split()` in helpers.
|
||||
|
||||
## LRN-248 — skills-dir packs and claude.ai connectors: measured facts CLI 2.1.316 (2026-11-02)
|
||||
- **Pattern**: skills-dir pack = `~/.claude/skills/<pack>/.claude-plugin/plugin.json` + `skills/<s>/SKILL.md`. Loads as `<name>@skills-dir` (manifest name, not folder). Nested skills listed ONCE as `pack:skill`; `Skill(skill)`, `Skill(pack:skill)`, typed `/skill`, `/pack:skill` all resolve. `defaultEnabled:false` → OFF with nothing written; local or `--settings` true turns it on. `--settings` false beats local true. `/reload-plugins` re-reads `enabledPlugins` from the settings files (skills + hooks mid-session; pack `.mcp.json` needs a new session) but NOT a `--settings` file: a pack OFF by flag comes back only through a relaunch. claude.ai connectors load under `-p` (2.1.316; not on 2026-10-25); `deniedMcpServers:[{serverName:"claude.ai X"}]` per project drops them (199 → 192 tools), `disableClaudeAiConnectors:true` drops all (any-source-true); lists UNION across files; `serverUrl` wildcard matches nothing (no URL exposed). Tool budget bare project 199 = 28 builtin + 1 model-router + 158 higgsfield + 8 Claude Docs + 4 Indeed.
|
||||
- **Context**: phase 5 spikes, scratch projects, `claude -p … --output-format stream-json --verbose`, init message `plugins[] skills[] tools[] mcp_servers[]`.
|
||||
- **Apply**: any per-project/per-conversation tool switching; design gates read the effective state, not files.
|
||||
|
||||
## LRN-249 — Claude Code settings root = git common dir; mirror it, stop below HOME (2026-11-02)
|
||||
- **Pattern**: Claude Code reads/writes `.claude/settings.local.json` at the git repo root (worktree → main checkout root, `git rev-parse --path-format=absolute --git-common-dir` parent); shared `.claude/settings.json` from the session dir. A tool mirroring the effective state must resolve the root the same way, stop below `$HOME` (`~/.claude/` is not a project), and fall back to the nearest `.claude/`/`CLAUDE.md`/`.git` outside git.
|
||||
- **Context**: `lib/profile.sh find_root`; code review caught the nearest-marker walk diverging in worktrees and monorepo packages.
|
||||
- **Apply**: statusline, hooks, gates run from `.cwd`/`project_dir`; never trust `$PWD` as the project.
|
||||
|
||||
## LRN-250 — One jq pass over many files beats 30 jq spawns (13 ms vs 120 ms) (2026-11-02)
|
||||
- **Pattern**: one jq program beats many: 30 jq spawns ≈ 120 ms (34 × `jq -n 1` = 118-137 ms measured); `jq -rn --rawfile a f1 --rawfile b f2 … -f prog.jq inputs…` with `def parse: try fromjson catch {}` and `input_filename` reads every file (absent → /dev/null → `{}`) in one pass. `current --plain` = 2 jq processes, 13-30 ms (target 50).
|
||||
- **Context**: `lib/profile-state.jq`; statusline runs it on every refresh.
|
||||
- **Apply**: any hook or statusline computing state from several JSON files.
|
||||
|
||||
## LRN-251 — Plan against a stale tree: re-survey at Task 0, derive removal lists at run time (2026-11-02)
|
||||
- **Pattern**: a plan written against a tree surveyed hours earlier is wrong by execution time: the live machine had switched to profile `backend` (impeccable parked as a real dir, 54 parked links, 20 flat links) between survey and plan; hardcoded `rm`/`mv` lists failed, and the only fix path a blind executor sees destroys the only install. Cure: Task 0 = snapshot (`find … -printf '%y %p %l'`) + verify assumptions; derive every removal list at run time (`find -type l`, remove by name); never delete a real dir, move it; keep the snapshot as the rollback recipe.
|
||||
- **Context**: phase 5 plan r1 → r2, caught by the robustness and correctness challengers before execution.
|
||||
- **Apply**: every plan touching machine-owned layout (symlinks, installs, caches).
|
||||
|
||||
## LRN-252 — stream-json first line is hook_started; multi-turn canary on a FIFO; OFF pack via --settings (2026-11-02)
|
||||
- **Pattern**: `claude -p --output-format stream-json --verbose`: the FIRST line is a `type=system subtype=hook_started` event (session-start hook), not init; select `type == "system" && subtype == "init"` over all lines. Multi-turn headless = `--input-format stream-json` on a FIFO/coproc: send a turn, wait for its `result`, edit files, send the next (one session id throughout). A canary pack with `defaultEnabled:false` turned on only via `--settings` is invisible to every other conversation; clean up with `mv` (rm/trap calls get refused by the permission rules).
|
||||
- **Context**: phase 5 Task 1 and Task 12 canaries; the first reload canary mistakenly spanned two sessions.
|
||||
- **Apply**: every headless measurement of plugins/skills/tools.
|
||||
|
||||
## LRN-253 — Commit a tracked file with uncommitted UI writes through the git index (2026-11-02)
|
||||
- **Pattern**: commit a change to a tracked file whose working copy carries uncommitted writes you must keep (settings.json UI writes): `git show HEAD:f | jq '<edit>' > tmp && git update-index --cacheinfo 100644,"$(git hash-object -w tmp)",f && git commit`, then patch the working copy with jq into a temp file and `cp` it back. Never `git checkout -- f`, never `git stash` (pop can take someone else's stash), never `git add -p` (interactive, unavailable), never `jq … > f` (truncates on failure).
|
||||
- **Context**: phase 5 Task 13 listing budget; BLK-039.
|
||||
- **Apply**: any commit to settings.json or another file the harness writes to.
|
||||
@@ -71,7 +71,7 @@ Shared rules for every phase:
|
||||
- Cleanup: CLAUDE.global.md loses the moved sections (one pointer line each where needed), citers patched (doctrine-citers census); BDR-031 citers.
|
||||
|
||||
- [ ] **model-router: ask before routing to Fable** (user ask 2026-11-02, after the phase 5 merge: both touch `mods/model-router/routing.json`). `/feat` on the mod: a `routing.json` key `askTier` (default `best`; `/route ask-tier on|off`) makes the router ask, once per span, BEFORE applying a route whose resolved model sits in that tier, with the reason (phase + its `about`, origin: skill row / `/route` / prompt rule / agent row) and the options `Fable` · `Opus instead (big tier)` · `stop asking this session`; no memory in `confirmed` (the existing first-use confirmation stays as is); never asks in `-p` (`askOr` already falls back to LATER). Files: mods/model-router/hooks/register.ts (+ register.test.ts), routing.json, USAGE.md (`/route` section).
|
||||
- [ ] **Phase 5, per-project and per-conversation profiles, native packs** (redesigned 2026-10-25, shrunk the same day)
|
||||
- [x] **Phase 5, per-project and per-conversation profiles, native packs** (redesigned 2026-10-25, shrunk the same day; shipped 2026-11-02 on feature/phase5-profiles-packs: BDR-134, spec docs/superpowers/specs/2026-11-01-phase5-profiles-packs-design.md, contract .claude/tasks/contracts/2026-11-01-phase5-profiles-packs-1300.md; user steps left: MIGRATION "Profiles and packs (2026-11)" step 4 `.bashrc`, `/context` on full/dev/web; follow-ups: census `grep -qxF`, fragment top-level key allowlist, MIGRATION step 2 `$root` re-derivation + autostash-conflict note)
|
||||
- Facts 2026-10-24/25 (scratch projects, fresh headless sessions, canaries, run concurrently, one shared ~/.claude): `.claude/settings.local.json` `enabledPlugins` per project works both ways and concurrently; `claude --settings '<json>'` gives two SIMULTANEOUS conversations in the SAME project different plugin sets; a skills-dir plugin obeys both; plugin skills keep their short name (`ui-styling` resolves) but verify `<plugin>:<name>` too (router rows must match both); plugin agents need the `plugin:` prefix; `permissions.deny Skill(x)` does not hide a skill; `skillOverrides` does not reach plugin skills (packs hide by disabling, guide); a user-scope MCP cannot be switched off per project by settings: project MCP belongs in a pack `.mcp.json`; claude.ai connectors do not load under `-p`.
|
||||
- User answers 2026-10-25: profile per project and per conversation, never one for all; tracked `.claude/settings.json` keeps deny/allow only, profiles go local; a project without a profile gets a proposal once, written on accept; the global mode (skills/ ↔ skills-disabled/ symlinks + user-scope plugin toggling) is DELETED; core = everything except the heavy packs (design, seo/geo, web-validate, scroll/3d, higgsfield, gstack); agents stay global; a skill needing an off pack proposes to enable it then `/reload-plugins` (spike first); all 11 profiles kept as pack compositions.
|
||||
- Packs: each heavy group becomes a skills-dir plugin `skills/pack-<name>/` (`.claude-plugin/plugin.json` + `skills/<skill>/SKILL.md`, + `.mcp.json` for higgsfield, + hooks if any). Spike first: nested skills load once as plugin skills; gstack (external installer, symlinks) as a pack.
|
||||
|
||||
Reference in new issue
Block a user