greprag 5.45.0 → 5.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ description: |
7
7
  for drift, mine episodic memory, promote project-agnostic repairs to global.
8
8
  One-at-a-time conversational review — never bulk.
9
9
 
10
- Trigger phrases: "/mechanic", "/lore-advisor" (alias), "/lore" (alias), "digest
10
+ Trigger phrases: "/mechanic", "digest
11
11
  fixes", "digest smells", "drain the queue", "any friction", "any fixes", "what
12
12
  needs repairing", "review my fixes", "audit fixes", "mine episodic".
13
13
  metadata:
@@ -27,7 +27,12 @@ The Mechanic keeps the harness healthy. The loop is **friction → fix → repai
27
27
 
28
28
  **The one gate: is this worth repairing?** If yes → repair it on the lowest rung that holds. If there's no repair worth doing — not even a line in a doc — drop it. (Can't fix it and won't surface it → you don't care.)
29
29
 
30
- **Conversational, never autonomous.** Every repair / drop / edit / record goes through the operator one at a time. Bulk actions are forbidden.
30
+ **Autonomy = blast radius** (not repair-vs-not). Don't route every repair through the operator gate by what can be affected:
31
+ - **Tier 0 — inert / instantly-reversible, zero reach → just do it, report.** Author schemas **born-shadow** (logs only, injects nothing until armed), record/close/delete fixes, fix skill/doc text you own, ADR entries, log friction. Born-shadow makes authoring free — nothing fires until graduation.
32
+ - **Tier 1 — local code, test-covered, reversible → do it, commit, report.** Contained to the repo, green on its own tests, no prod/fleet/external reach.
33
+ - **Tier 2 — real reach or hard to undo → confirm first.** ARM a schema (shadow→active = fleet-wide inject), any deny/transform, prod/deploy/secrets/money/external, untested load-bearing code, deleting what you didn't author, editing a file a peer is live in.
34
+
35
+ The seam: **author freely (shadow), arm deliberately (operator).** Full doctrine: `docs/mechanic-repairs.md` D10.
31
36
 
32
37
  > **CLI:** `greprag fix` is the canon — verbs `log · list · repair · delete · search · scopes`.
33
38
 
@@ -50,8 +55,8 @@ Same gate the hourly compactor applies at write-time — Mechanic and compactor
50
55
 
51
56
  ## Hard rules
52
57
 
53
- - **Never repair / drop / promote without explicit operator confirm**each is its own y/n.
54
- - **Never bulk-prune.** One at a time. "Prune the obvious ones" confirm the list aloud first.
58
+ - **Tier-2 actions need explicit confirm** (arm/graduate, deny/transform, prod·secrets·external, deleting what you didn't author). Tier 0/1 don't just do + report.
59
+ - **Bulk is fine for Tier-0 when the set is named aloud** (clearing verified-stale / noise fixes); never bulk a Tier-2 action.
55
60
  - **Never edit `~/.claude/docs/chip-spawn.md` without confirm.** Global rules are sticky.
56
61
  - **Cross-project carve-out.** Default to the current project (resolved via `greprag fix list`). The Phase 0 census MAY read sibling queues to show where fixes piled up; *draining* one requires the operator to name it, and every `add`/`delete` against it MUST carry `--project <that-project>`. Never touch a sibling silently.
57
62
 
@@ -76,8 +81,9 @@ A fix is a raw, undigested signal. Auto-detected friction fixes carry a type; ha
76
81
  4. For each, **investigate** (reproduce / read the code or hooks to confirm it's real), then ask two questions:
77
82
 
78
83
  - **Is there a broken MECHANISM?** Repair it on the lowest rung that holds:
79
- 1. **Hooks first.** A PreToolUse guard, a UserPromptSubmit injection, a notification — same machinery as lore-triggers, ships as DATA, no deploy. Most mechanism fixes repair here.
84
+ 1. **Hooks first.** A PreToolUse guard, a UserPromptSubmit injection, a notification — same machinery as fix-triggers, ships as DATA, no deploy. Most mechanism fixes repair here.
80
85
  2. **Code second.** Only when a hook can't express it: server logic, a bounce, a schema/CLI change. Don't implement code-tier inline — spawn a chip (`spawn_task`, `~/.claude/docs/chip-spawn.md`) or hand to the operator.
86
+ 3. **Lock it (regression rung).** A code/mechanism repair MUST also mint a regression test from the REAL failure signal (the smell's evidence / a repro from the trace), so the *behavior* is locked, not just the lore. The queue's product is **fix + lore + locked test** — an ADR locks the *why* in prose; this locks the *what* in an executable. Don't retire the fix until the test exists (fails without the repair, passes with it).
81
87
 
82
88
  Recurring failure class → route through `/root-cause`: repair the pattern, never guard today's trigger.
83
89
 
@@ -87,7 +93,7 @@ A fix is a raw, undigested signal. Auto-detected friction fixes carry a type; ha
87
93
  ```
88
94
 
89
95
  **Typed friction fixes.** The hourly detector writes its fixes tagged `[friction:<type> · scope=…]` with a pre-extracted `Fix:` clause and structured `frictionType`/`resolution` metadata. Do NOT re-derive — repair the provided fix, mapped by type:
90
- - `discovery-waste` — agent rediscovered lore. The `text` IS the fact; the repair is to surface it (fact-seed / session-start injection so no one rediscovers it).
96
+ - `discovery-waste` — agent rediscovered known project knowledge. The `text` IS the fact; the repair is to surface it (fact-seed / session-start injection so no one rediscovers it).
91
97
  - `human-correction` — operator corrected the agent ≥2× on one point. Repair BOTH legs: the `Fix:` is the durable rule (gate it, `fix log --repaired`), AND the mechanism gap (a `UserPromptSubmit`/`PreToolUse` injection at the moment it's needed, or a CLAUDE.md/skill addendum). Rarely `(n)oise` — the operator already paid attention twice; default `(b)oth`.
92
98
  - `repetition` / `reversal` — the `Fix:` is the lesson; surface it, and repair the gap that let the loop/rework happen if there is one.
93
99
  - `model-thrash` — usually no clean repair (`resolution` null); record the deciding criterion only if the window settled it.
@@ -117,7 +123,7 @@ A fix is a raw, undigested signal. Auto-detected friction fixes carry a type; ha
117
123
 
118
124
  ## Phase A — Drift check
119
125
 
120
- 1. Pull standing fixes: `greprag fix list --repaired --format json` → `lore[]` (`nodeId`, `text`, `scope`, `createdAt`).
126
+ 1. Pull standing fixes: `greprag fix list --repaired --format json` → `fix[]` (`nodeId`, `text`, `scope`, `createdAt`).
121
127
  2. For each, run four heuristics:
122
128
  - **File-path** — extract `packages/…`, `~/.claude/…`, `adr/…`, `docs/…`, `migrations/…`, `tests/…`; `test -f <path>` → MISSING flags `file-not-found:<path>`.
123
129
  - **Dead-convention** — derive live, NOT a static list (a frozen list rots like any artifact). `greprag memory search "<key term> renamed OR removed OR replaced OR deprecated"`; if the fix asserts a convention the codebase dropped → `dead-convention`.
@@ -178,7 +184,7 @@ Append `(phase <X> skipped)` per skipped phase.
178
184
 
179
185
  ## When to invoke
180
186
 
181
- - Operator types `/mechanic` (or aliases `/lore-advisor`, `/lore`), or says "digest fixes", "drain the queue", "any friction".
187
+ - Operator types `/mechanic`, or says "digest fixes", "drain the queue", "any friction".
182
188
  - The `⚠ N fixes awaiting digestion` footer fires on a greprag command — offer Phase 0.
183
189
  - "audit my fixes", "what needs repairing", "mine episodic", "any new learnings worth keeping?"
184
190
  - Proactively at the end of a `/greprag` briefing if the queue is non-empty, if `greprag fix list --repaired` shows entries > 90 days, OR right after a refactor/rename (drift likely).
@@ -194,7 +200,8 @@ Append `(phase <X> skipped)` per skipped phase.
194
200
  Repairs (D3 rows attached to fixes) are managed with `greprag mechanic`, not by editing hooks:
195
201
 
196
202
  ```
197
- greprag mechanic status inventory: live (shadow|active) repairs grouped by status;
203
+ greprag mechanic status inventory: live (shadow|active) repairs grouped by status,
204
+ each with a verdict (working|failed|harmful|unproven|dormant);
198
205
  ⚑ marks shadow rows ready to graduate (≥3 fires or ≥7 days)
199
206
  greprag mechanic enable <nodeId> ratify: shadow → active (the graduate gate)
200
207
  greprag mechanic disable <nodeId> least destructive: active → shadow (logging continues);
@@ -207,4 +214,9 @@ greprag mechanic off / on PANIC SWITCH — local file, no network; s
207
214
  evidence but injects nothing. Graduation is evidence-first — when `status` flags a row `⚑`, review
208
215
  its fire history (`why`) and `enable` it. Nothing goes live without the operator; the gates are
209
216
  *merge* (code/file repairs) and *graduate* (row repairs), never a conversational queue walk.
210
- Full doctrine: `docs/mechanic-repairs.md` Part 4, D6–D8.
217
+
218
+ **Monitored, harm-first (Part 8).** You don't babysit live repairs — the monitor does. Each active
219
+ repair earns a verdict: the **harm floor** auto-reverts a repair that's *spewing damage* (over-firing,
220
+ or new friction correlated with its fires) back to `shadow` + notifies; the efficacy loop marks
221
+ `failed` when its target friction recurs; otherwise it earns `working`. The operator watches the
222
+ verdict column; the system self-heals. Full doctrine: `docs/mechanic-repairs.md` Part 4, 8, D6–D10.
@@ -78,7 +78,7 @@ Monitor (persistent:true): `greprag inbox watch --session <your-8hex> --json --o
78
78
 
79
79
  ## Before composing
80
80
 
81
- `greprag fix list --repaired --project <chip-project> --format markdown` — take the `## chip-startup` section. (Don't use `fix search` for this pull: it requires a positional query that lexically filters, and the query-less `--scope` form mis-parses `--scope` as the query.) If non-empty, paste at top of body as `**Project Fixes (do not re-discover):**`. Saves 10-20 startup turns.
81
+ `greprag fix list --repaired --scope chip-startup --limit 20 --project <chip-project> --format markdown` — already scoped, no slicing (the `--scope`/`--limit` filters landed in fix `1dc5a185`; `fix search` still needs a positional query, so don't use it for this pull). If non-empty, paste at top of body as `**Project Fixes (do not re-discover):**`. Saves 10-20 startup turns.
82
82
 
83
83
  ## Merge before testing globally (HARD RULE)
84
84