greprag 5.22.0 → 5.22.2

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.
@@ -1,15 +1,17 @@
1
1
  ---
2
2
  name: lore-advisor
3
3
  description: |
4
- Audit project lore for drift, mine episodic memory for emergent learnings,
5
- promote project-agnostic lore to global. One-at-a-time conversational
4
+ Digest the smell queue (raw field signals fix the broken mechanism + instantiate
5
+ durable lore), audit project lore for drift, mine episodic memory for emergent
6
+ learnings, promote project-agnostic lore to global. One-at-a-time conversational
6
7
  review — never bulk-prune.
7
8
 
8
- Trigger phrases: "/lore-advisor", "/lore", "review my lore", "audit lore",
9
- "lore is stale", "prune lore", "mine episodic for lore".
9
+ Trigger phrases: "/lore-advisor", "/lore", "digest smells", "drain the smell queue",
10
+ "any smells", "review my lore", "audit lore", "lore is stale", "prune lore",
11
+ "mine episodic for lore".
10
12
  metadata:
11
13
  author: travsteward
12
- version: "1.1.0"
14
+ version: "1.2.0"
13
15
  repository: https://github.com/travsteward/greprag
14
16
  license: MIT
15
17
  ---
@@ -24,14 +26,17 @@ Lore is moving from a passive list toward **event-bound / semantic injection**
24
26
 
25
27
  The skill is **conversational**, not autonomous. Every prune / promote / edit / add decision goes through the operator one at a time. Bulk actions are forbidden.
26
28
 
29
+ **Two feeds, one digestion.** Lore now has two supplies: the *deliberate* smell queue (`greprag lore smell`, raw field signals — `docs/lore-smell.md`) and the *automatic* episodic `learned` / `ruled_out` claims. Phase 0 drains the smell queue first; Phase B mines episodic. Both pass through the same durability gate — but a smell additionally asks whether a broken **mechanism** in the harness needs fixing (the fix ladder in Phase 0), not just whether a durable truth needs recording.
30
+
27
31
  ## Trigger phrases
28
32
 
29
- `/lore-advisor`, `/lore`, "review my lore", "audit lore", "lore is stale", "prune lore", "mine episodic for lore".
33
+ `/lore-advisor`, `/lore`, "digest smells", "drain the smell queue", "any smells", "review my lore", "audit lore", "lore is stale", "prune lore", "mine episodic for lore".
30
34
 
31
35
  ## What it does
32
36
 
33
- Three phases, run in order. Operator may skip any phase. Each phase walks one entry at a time — never bulk-prune.
37
+ Four phases, run in order (Phase 0 first). Operator may skip any phase. Each phase walks one entry at a time — never bulk-prune.
34
38
 
39
+ - **Phase 0 — Smell digestion.** Drain the raw smell queue (`greprag lore smells`): per smell, fix the broken mechanism (hooks first, code second) and/or instantiate the durable truth, then retire it. Deliberate field signals outrank auto-mined claims, so this runs first.
35
40
  - **Phase A — Drift check.** Scan current lore for rot: stale file paths, conventions the codebase no longer follows (derived live, NOT from a static list), misfiled static-knowledge, age-based decay.
36
41
  - **Phase B — Episodic mining.** Mine episodic memory's `learned` / `ruled_out` claims; surface only candidates that pass the durability gate; offer to add.
37
42
  - **Phase C — Global promotion.** Identify project-agnostic lore that belongs in `~/.claude/docs/chip-spawn.md` as a universal rule.
@@ -55,6 +60,54 @@ This is the same gate the hourly compactor applies at write-time (greprag, 2026-
55
60
 
56
61
  ## Phases
57
62
 
63
+ ### Phase 0 — Smell digestion
64
+
65
+ Smells are the *deliberate* lore feed: raw, undigested signals dropped from the field via `greprag lore smell` (`docs/lore-smell.md`). Unlike an episodic claim, a smell often names a **broken mechanism in the harness**, not just a fact. Digestion does two jobs per smell — **fix** the mechanism and **instantiate** the durable truth — and runs FIRST, because a deliberate signal outranks auto-mined claims.
66
+
67
+ 1. Pull the queue:
68
+ ```bash
69
+ greprag lore smells --format json
70
+ ```
71
+ Parse `smells[]` (`nodeId`, `text`, `createdAt`). Empty → say "No smells awaiting digestion." and move to Phase A.
72
+
73
+ 2. Walk one smell at a time. First **untangle** it — a single drop often conflates several mechanisms and truths (e.g. a dead-mailbox bug AND a "re-task ≠ launch a chip" insight). Separate them before triaging.
74
+
75
+ 3. For each, **investigate** (reproduce / read the relevant code or hooks to confirm it's real), then ask the two questions:
76
+
77
+ - **Is there a broken MECHANISM?** Fix it via the **fix ladder** — lowest rung that holds the fix:
78
+ 1. **First pass — fix it in the hooks.** A PreToolUse guard, a UserPromptSubmit injection, a notification. Cheapest, reversible, and the same machinery as lore-triggers — ships as DATA, no deploy. Most mechanism smells resolve here.
79
+ 2. **Second pass — fancier coding.** Only when a hook can't express the fix: server-side logic, a bounce, a schema or CLI change. The advisor does NOT implement code-tier fixes inline — spawn a chip (`spawn_task`, per `~/.claude/docs/chip-spawn.md`) or hand to the operator.
80
+
81
+ If the fix is architectural (a recurring failure class), route through `/root-cause` — fix the pattern that makes the bug possible, never slap a guard on today's trigger.
82
+
83
+ - **Is there a durable TRUTH?** Apply the durability gate (below). If it passes, instantiate as durable lore — and, once triggers ship, attach its injection rule (`docs/lore-triggers.md`):
84
+ ```bash
85
+ greprag lore add "<clean standing rule>" --scope <scope>
86
+ ```
87
+
88
+ 4. **Summarize + confirm before ANY action** — a smell is a brief, and the hard rule is the advisor never auto-acts on a brief. Present:
89
+ ```
90
+ SMELL [<nodeId>] (<date>)
91
+ "<text>"
92
+ Triage:
93
+ • mechanism: <...> → fix: [hook|code|root-cause] <proposal>
94
+ • truth: <...> → lore: "<rule>" scope=<s>
95
+ Action? (f)ix / (i)nstantiate / (b)oth / (s)kip / (n)oise
96
+ ```
97
+ - **fix** → apply the hook-tier fix (after confirm), or spawn the chip for a code-tier fix.
98
+ - **instantiate** → `greprag lore add "<rule>" --scope <scope>` with the durability-gated rule.
99
+ - **both** → fix and instantiate.
100
+ - **skip** → leave the smell in the queue for a later pass (no retire).
101
+ - **noise** → already-handled or not real; retire without action.
102
+
103
+ 5. **Retire** only once the smell's content is preserved — the fix landed, a durable lore entry captures the constraint, OR a chip/TODO owns the code-tier fix. Never retire a smell whose fix is merely *planned*. Retire = delete (interim, until a real `status` field exists):
104
+ ```bash
105
+ greprag lore delete <nodeId>
106
+ ```
107
+ Confirm by printing `Retired smell [<nodeId>].`
108
+
109
+ 6. Phase summary: `Phase 0: N smells. Fixed F (H hooks, C chips). Instantiated I. Skipped S. Noise X.`
110
+
58
111
  ### Phase A — Drift check
59
112
 
60
113
  1. Pull the current project's lore as JSON:
@@ -168,16 +221,17 @@ The richest lore source is the compactor's structured `learned` / `ruled_out` cl
168
221
  After all three phases, print one combined line:
169
222
 
170
223
  ```
171
- Reviewed N lore. Pruned X. Edited Y. Added Z from episodic. Promoted W to global.
224
+ Digested D smells (fixed F, instantiated I). Reviewed N lore. Pruned X. Edited Y. Added Z from episodic. Promoted W to global.
172
225
  ```
173
226
 
174
227
  If any phase was skipped (operator pressed q / Ctrl-C / typed "skip phase"), include `(phase <X> skipped)` per skipped phase.
175
228
 
176
229
  ## When this skill should be invoked
177
230
 
178
- - Operator types `/lore-advisor` or `/lore`.
231
+ - Operator types `/lore-advisor` or `/lore`, or says "digest smells," "drain the smell queue," "any smells."
232
+ - The `⚠ N smells awaiting digestion` footer fires on a greprag command — the smell-queue nudge. Offer to run Phase 0.
179
233
  - Operator says "audit my lore," "lore is stale," "prune lore," "mine episodic for lore," "any new learnings worth saving?"
180
- - Proactively offer the skill at the end of a `/greprag` briefing if `greprag lore list` shows entries older than 90 days OR if the operator just finished a refactor / rename and lore drift is likely.
234
+ - Proactively offer the skill at the end of a `/greprag` briefing if `greprag lore smells` is non-empty, if `greprag lore list` shows entries older than 90 days, OR if the operator just finished a refactor / rename and lore drift is likely.
181
235
 
182
236
  ## Notes
183
237