greprag 5.49.6 → 5.49.9

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.
Files changed (51) hide show
  1. package/dist/commands/collision-reminder.d.ts +14 -0
  2. package/dist/commands/collision-reminder.js +40 -0
  3. package/dist/commands/collision-reminder.js.map +1 -0
  4. package/dist/commands/coordinate-gate.d.ts +12 -6
  5. package/dist/commands/coordinate-gate.js +24 -10
  6. package/dist/commands/coordinate-gate.js.map +1 -1
  7. package/dist/commands/corpus/client.d.ts +5 -1
  8. package/dist/commands/corpus/client.js +10 -3
  9. package/dist/commands/corpus/client.js.map +1 -1
  10. package/dist/commands/corpus/index.js +21 -1
  11. package/dist/commands/corpus/index.js.map +1 -1
  12. package/dist/commands/corpus/manage.js +31 -5
  13. package/dist/commands/corpus/manage.js.map +1 -1
  14. package/dist/commands/corpus/search.js +13 -6
  15. package/dist/commands/corpus/search.js.map +1 -1
  16. package/dist/commands/corpus/status.js +2 -1
  17. package/dist/commands/corpus/status.js.map +1 -1
  18. package/dist/commands/corpus/tags.d.ts +17 -0
  19. package/dist/commands/corpus/tags.js +91 -0
  20. package/dist/commands/corpus/tags.js.map +1 -0
  21. package/dist/commands/corpus-reminder.d.ts +15 -0
  22. package/dist/commands/corpus-reminder.js +34 -0
  23. package/dist/commands/corpus-reminder.js.map +1 -0
  24. package/dist/commands/friction-reminder.d.ts +22 -44
  25. package/dist/commands/friction-reminder.js +45 -63
  26. package/dist/commands/friction-reminder.js.map +1 -1
  27. package/dist/commands/init.js +7 -14
  28. package/dist/commands/init.js.map +1 -1
  29. package/dist/commands/load-primer-reminder.d.ts +28 -0
  30. package/dist/commands/load-primer-reminder.js +51 -0
  31. package/dist/commands/load-primer-reminder.js.map +1 -0
  32. package/dist/commands/load.d.ts +15 -0
  33. package/dist/commands/load.js +112 -0
  34. package/dist/commands/load.js.map +1 -0
  35. package/dist/commands/memory-reflex.d.ts +17 -112
  36. package/dist/commands/memory-reflex.js +24 -233
  37. package/dist/commands/memory-reflex.js.map +1 -1
  38. package/dist/commands/reminder-registry.d.ts +12 -1
  39. package/dist/commands/reminder-registry.js +48 -4
  40. package/dist/commands/reminder-registry.js.map +1 -1
  41. package/dist/commands/reminder-types.d.ts +33 -0
  42. package/dist/commands/version-reminder.d.ts +15 -0
  43. package/dist/commands/version-reminder.js +34 -0
  44. package/dist/commands/version-reminder.js.map +1 -0
  45. package/dist/hook.js +134 -274
  46. package/dist/hook.js.map +1 -1
  47. package/dist/index.js +6 -0
  48. package/dist/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/skill/templates/chip-leader.md +188 -0
  51. package/skill/templates/chip-spawn.md +4 -4
@@ -0,0 +1,188 @@
1
+ # Chip Leader — plan a MULTI-CHIP mission before the first spawn
2
+
3
+ > Loaded via `greprag load chip-leader` — usually from *within* `greprag load
4
+ > chip-spawn` (its "Part of a multi-chip mission?" gate), the moment you realize
5
+ > ≥2 chips aim at one objective, or you're about to spawn a 2nd chip. A single
6
+ > chip → straight to `greprag load chip-spawn`. Two or more → STOP, pick a mode
7
+ > below, and plan first.
8
+
9
+ `chip-spawn` launches one worker correctly; **chip-leader is the commander** who
10
+ plans the whole mission *before* any worker deploys and reconciles them *after*.
11
+ Topology is a planning decision, not an execution afterthought — draw the map
12
+ before mobilizing the troops.
13
+
14
+ **Hard fire:** the moment you're about to spawn the **2nd chip**, stop and plan.
15
+ Spawn-then-plan is the exact failure this prevents.
16
+
17
+ ## Two modes — pick ONE before planning
18
+
19
+ Forks on one question: **do the chips share one objective, or are they independent?**
20
+
21
+ | | **Mode A — Mission** | **Mode B — Orchestrator** |
22
+ |---|---|---|
23
+ | **When** | ≥2 chips at ONE objective, usually ONE repo | N independent issues, often DIFFERENT repos |
24
+ | **Relationship** | chips have seams — shared files, data contracts, ordering | disjoint by construction — no seams |
25
+ | **Branching** | one integration branch `feature/<slug>`; chips base off it, merge into it | each chip self-contained in its OWN repo; no integration branch |
26
+ | **Merge** | leader reconciles all → ONE reviewed merge to master | each chip merges to ITS OWN repo's default, independently |
27
+ | **Gate** | whole feature run end-to-end on the integration worktree | per-chip verification; no cross-chip gate |
28
+ | **Leader's core job** | merge-reconciliation across seams | **dispatch + completion judgment** — chips report back, you adjudicate |
29
+
30
+ Both modes share decompose, dispatch (via `greprag load chip-spawn`), the label
31
+ discipline, and the single-watcher rule. They diverge on topology and the back
32
+ half (reconcile vs. adjudicate).
33
+
34
+ ## Mode A — Mission
35
+
36
+ ### The invariant that drives everything
37
+
38
+ `master` is the production trunk — `git push origin master` deploys. So:
39
+ - **Merged = ships on the next deploy.** A flag gates *behavior*, not *startup
40
+ code*: schema/migration statements and import-time side effects run regardless
41
+ of any feature flag. "Flag-gated" ≠ "inert on master."
42
+ - **Chips NEVER merge directly to master.** They reconcile on a feature
43
+ integration branch. Master only ever holds verified, deployable work.
44
+ - One objective → **one integration branch** → **one reviewed merge to master**.
45
+
46
+ ### Phase 1 — Decompose
47
+
48
+ Break the objective into workstreams (one per chip). For each, name:
49
+ - **Label** — a stable letter (`A`, `B`, `C`…). It becomes the chip's title prefix
50
+ (`Chip A: <verb>`) and the one handle you *and* the chip use end-to-end (title,
51
+ report-back self-ID, merge log). Letters, not numbers — workstream IDs, not an
52
+ execution order.
53
+ - **Parallel or sequential** — can it run independently, or need another's output?
54
+ - **Seams** — every place two workstreams touch: *shared file* (both edit the same
55
+ module → serialize at merge), *data contract* (one produces what another consumes
56
+ → producer merges first), *ordering dependency* (B meaningless until A lands).
57
+ - Disjoint workstreams (no shared file, no contract) → merge in any order.
58
+
59
+ Output the plan explicitly and **confirm it with the user before dispatching.**
60
+
61
+ ### Phase 2 — Topology
62
+
63
+ Detect the default branch first (`git -C <main> symbolic-ref refs/remotes/origin/HEAD`
64
+ → strip prefix; fallback `master`), then:
65
+
66
+ ```bash
67
+ git -C <main> worktree add .claude/worktrees/feature-<slug> -b feature/<slug> <default>
68
+ ```
69
+
70
+ Decide + write down: each chip's **base branch** = `feature/<slug>` (not master);
71
+ each chip's **merge target** = `feature/<slug>` (never master); **merge order**
72
+ (seam-sharers serialize, producer/base first; disjoint chips free); **test gate**
73
+ (the `feature-<slug>` worktree is where the whole feature runs end-to-end).
74
+
75
+ ### Phase 3 — Dispatch
76
+
77
+ Spawn each chip via `greprag load chip-spawn`, and in each brief include the four
78
+ things the plan decided:
79
+ 1. **Its seam** — which files/contracts it shares, and what to leave clean.
80
+ 2. **Its base branch** — branch off `feature/<slug>` (adjust chip-spawn's Block 1
81
+ `git worktree add ... <base>`).
82
+ 3. **Its merge target** — `feature/<slug>`, never master. Chips commit to their own
83
+ branch + report back; the leader does the merges.
84
+ 4. **Its label** — three places (spawn title alone does NOT reach FleetView's
85
+ watcher registry, which is auto-generated):
86
+ - **Spawn title** — `Chip <Label>: <verb phrase>`.
87
+ - **Registry retitle (Block 1)** — give the chip a line to run right after
88
+ worktree setup: `greprag session retitle <its-own-8hex> "Chip <Label> — <workstream>"`.
89
+ - **Report-back self-ID** — open its report with its label ("Chip B — DONE: …").
90
+
91
+ Arm ONE inbox watcher for all the chips' reports (never double-arm).
92
+
93
+ **Spawning is a commitment.** A `spawn_task` is not a draft: launching creates a
94
+ worktree + branch, and even a queued chip occupies its slug. Finalize the brief
95
+ before you spawn; to change/replace a chip, **cancel the old one FIRST** (dismiss
96
+ if queued; for a launched one, stop the session, then `git worktree remove` +
97
+ `git branch -D`), then spawn. Same-slug collision → spawn the replacement under a
98
+ fresh slug rather than fighting an OS file lock.
99
+
100
+ ### Phase 4 — Reconcile + integrate
101
+
102
+ As chips report `DONE`:
103
+ 1. **Merge into `feature/<slug>` in the planned order** (`--no-ff`, from the
104
+ integration worktree). Seam-sharers: base first, then the dependent.
105
+ 2. **On conflict at a seam** — expected; resolve it (you mapped it in Phase 1). On
106
+ an *unexpected* conflict, stop and re-examine the decomposition.
107
+ 3. **Recommend closing the chip out** as soon as its commits are reconciled (or
108
+ even just committed + reported) — the branch survives the session; you need the
109
+ branch, not the live session, to merge later. Don't wait to be asked.
110
+ 4. **Run the full feature end-to-end on the integration worktree** — the gate.
111
+ 5. **One reviewed merge to master, then clean up.** Only after the gate passes:
112
+ `feature/<slug>` → master, then deploy. Then sweep the worktrees (the cleanup
113
+ skill keys on "merged into master," so it won't remove chips until then).
114
+
115
+ **PRUNE AT THE MERGE (HARD RULE).** Each chip's *worktree* dies the moment its
116
+ branch merges into its target — same breath, never batched. The *branch* is the
117
+ safety net and lives until the master merge. Stale worktrees pile up precisely
118
+ because cleanup was deferred.
119
+
120
+ ## Mode B — Orchestrator (independent fan-out, cross-repo)
121
+
122
+ A list of independent issues, each self-contained in its own repo. Nothing to
123
+ integrate — every chip lives and ships on its own. Your job is **dispatch +
124
+ completion judgment**: each chip reports back because you hold the "done"
125
+ criterion.
126
+
127
+ ### B1 — Decompose AND screen
128
+
129
+ One chip per issue — but **screen each candidate first; not every issue is a
130
+ chip.** A chip must be a self-contained coding task in a clean git repo. Drop the
131
+ rest and say why: interactive-with-operator (needs his login/judgment), ops/comms
132
+ (submissions, third-party coordination, email), cross-repo config writes (e.g.
133
+ editing a skill under `~/.claude` — not a clean worktree target; do inline),
134
+ operator-owned manual tasks. (Reporting "none of these are chips" is a correct,
135
+ useful result.)
136
+
137
+ For each survivor record: **Label** (`A`/`B`/`C`…), **Target repo** (its root,
138
+ from `~/.greprag/projects.json` → becomes the chip's `cwd`), **Completion
139
+ criterion** (what "done" means, in YOUR words — you'll judge against it).
140
+
141
+ Output the screened plan (chips + dropped non-chips with reasons); confirm before
142
+ dispatch.
143
+
144
+ ### B2 — Topology: none shared
145
+
146
+ No integration branch. Each chip: **cwd** = its own repo root; **base branch** =
147
+ that repo's own default (detect per-repo); **merge target** = that repo's default,
148
+ or hold-for-review (default to hold so you adjudicate before anything ships).
149
+
150
+ ### B3 — Dispatch
151
+
152
+ Spawn each via `greprag load chip-spawn` with: `cwd` set; Block 1 worktree off the
153
+ repo's default; the label discipline; Block 2 reporting to **your** session; the
154
+ **completion criterion embedded in the brief**. Arm ONE watcher. Re-dispatch
155
+ discipline (cancel-before-respawn) identical to Mode A.
156
+
157
+ ### B4 — Adjudicate (replaces reconcile)
158
+
159
+ As each chip reports `DONE`: **verify against the criterion** (read the diff, run
160
+ it if needed — don't take "DONE" on faith); **decide per chip** (merge to its own
161
+ repo's default + deploy, or send back with specifics); **surface close-out per
162
+ chip** as it lands. No single end-of-mission master merge — N independent ones.
163
+
164
+ ## Safety rules
165
+
166
+ - **Never spawn the 2nd chip without picking a mode + planning.** Mode A for one
167
+ shared objective; Mode B for independent issues.
168
+ - **Mode B: screen before you spawn.** Interactive, ops/comms, cross-repo-config,
169
+ operator-owned tasks are NOT chips.
170
+ - **Never spawn a chip while a stale one for the same workstream is in flight —
171
+ CANCEL first.** `spawn_task` is a stateful commitment.
172
+ - **Mode A: never merge a chip branch to master.** Integration branch only.
173
+ - **Never let "it's flag-gated" justify merging untested work to master.**
174
+ Migrations and startup code ignore feature flags.
175
+ - **Confirm the decomposition with the user before dispatch.** Wrong seams =
176
+ painful merges.
177
+ - **Surface close-out proactively** as each chip reconciles.
178
+
179
+ ## Execution depth (advanced)
180
+
181
+ Orthogonal to mode: each workstream also picks a *vehicle* — bare subagent, a
182
+ leader-direct workflow, a simple chip, or an **orchestrator chip** (a lean chip
183
+ running an inner workflow swarm in its own worktree, for mixed-model missions
184
+ needing isolation + a human gate). Mixed-model work cannot be a simple chip
185
+ (`spawn_task` has no model param → chips are session-locked). Don't over-stack: a
186
+ one-file fix gets a subagent, not a three-tier hierarchy. If you need the
187
+ orchestrator-chip brief addendum or the recovery recipe for a chip mistakenly
188
+ merged to master, ask the operator — those live in the chip-leader skill docs.
@@ -2,11 +2,11 @@
2
2
 
3
3
  The `pre-spawn-check` PreToolUse hook **validates** chip prompts at the spawn boundary, but **cannot inject content** — `modifiedInput` is silently dropped by the CCD harness for MCP `spawn_task` calls (see `adr/spawn-task-hook-mode.md` 2026-05-27 entry). The agent writes Block 1 + Block 2 into the prompt itself. Validator rejects with `permissionDecision: deny` and a remediation reason if Block 1 or Block 2 markers are missing.
4
4
 
5
- > **Part of a multi-chip mission?** If this chip is one of ≥2 aimed at a single objective, you should already be inside a `/chip-leader` plan — your **base branch** and **merge target** (the integration branch, *never* master) come from it. If you're not, stop and run `/chip-leader` first. A lone chip targeting its own objective proceeds here directly.
5
+ > **Part of a multi-chip mission?** If this chip is one of ≥2 aimed at a single objective, you should already be inside a chip-leader plan — your **base branch** and **merge target** (the integration branch, *never* master) come from it. If you're not, stop and run `greprag load chip-leader` first. A lone chip targeting its own objective proceeds here directly.
6
6
 
7
7
  ## What the agent provides
8
8
 
9
- - `title: "Chip: <verb-phrase>"` — `Chip: ` prefix enforced. **Multi-chip mission?** Use the leader-assigned label: `"Chip <Label>: <verb-phrase>"` (Label = `A`/`B`/`C`… per workstream, from `/chip-leader`) — e.g. `"Chip B: Build freshness engine"`. The validator accepts `Chip: `, `Chip A: `, `Chip 1: ` (regex `^Chip( [A-Za-z0-9]+)?: `). The label is the shared handle the leader and chip both use end-to-end (title → report-back self-ID → merge references).
9
+ - `title: "Chip: <verb-phrase>"` — `Chip: ` prefix enforced. **Multi-chip mission?** Use the leader-assigned label: `"Chip <Label>: <verb-phrase>"` (Label = `A`/`B`/`C`… per workstream, from chip-leader) — e.g. `"Chip B: Build freshness engine"`. The validator accepts `Chip: `, `Chip A: `, `Chip 1: ` (regex `^Chip( [A-Za-z0-9]+)?: `). The label is the shared handle the leader and chip both use end-to-end (title → report-back self-ID → merge references).
10
10
  - `prompt:` — Block 1 + task body + Block 2 (templates below).
11
11
  - `cwd:` — optional, lands the chip in a different project root. Repo paths: `~/.greprag/projects.json`.
12
12
 
@@ -33,7 +33,7 @@ Your parent's session id is `<8-hex-parent>`. The `IN-FLIGHT` ping is non-negoti
33
33
  ---
34
34
  ````
35
35
 
36
- **Multi-chip mission (`/chip-leader`)?** The spawn title alone does NOT reach FleetView's watcher registry — that title is auto-generated by gpt-5.4-nano from your opening turn. So the leader will have you **stamp your registry title in Block 1**, right after the `cd` into the worktree:
36
+ **Multi-chip mission (`greprag load chip-leader`)?** The spawn title alone does NOT reach FleetView's watcher registry — that title is auto-generated by gpt-5.4-nano from your opening turn. So the leader will have you **stamp your registry title in Block 1**, right after the `cd` into the worktree:
37
37
 
38
38
  ```bash
39
39
  greprag session retitle <your-own-8hex> "Chip <Label> — <workstream>"
@@ -86,4 +86,4 @@ Chips never `npm link` from the worktree — dangling symlinks silently break th
86
86
 
87
87
  ## Parent merge discipline — prune at the merge (HARD RULE)
88
88
 
89
- When you (the parent) merge a chip branch — via `/commit` or raw `git merge` — prune in the same breath: junction guard (`~/.claude/skills/commit/guard-junctions.sh <worktree>`), `git worktree remove .claude/worktrees/<slug>`, and `git branch -d chip/<slug>` once merged. Deferred cleanup = stale worktrees piling up (field state 2026-06-10: 3 leftovers). Multi-chip missions: worktree dies at the feature-branch merge; the branch lives until the master merge (`/chip-leader` Phase 4).
89
+ When you (the parent) merge a chip branch — via `/commit` or raw `git merge` — prune in the same breath: junction guard (`~/.claude/skills/commit/guard-junctions.sh <worktree>`), `git worktree remove .claude/worktrees/<slug>`, and `git branch -d chip/<slug>` once merged. Deferred cleanup = stale worktrees piling up (field state 2026-06-10: 3 leftovers). Multi-chip missions: worktree dies at the feature-branch merge; the branch lives until the master merge (chip-leader Phase 4).