greprag 5.60.3 → 5.60.5
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.
- package/dist/codex-chip-hooks.d.ts +2 -7
- package/dist/codex-chip-hooks.js +25 -159
- package/dist/codex-chip-hooks.js.map +1 -1
- package/dist/codex-steering.d.ts +2 -1
- package/dist/codex-steering.js +8 -5
- package/dist/codex-steering.js.map +1 -1
- package/dist/commands/codex-chip/bootstrap.d.ts +8 -0
- package/dist/commands/codex-chip/bootstrap.js +103 -0
- package/dist/commands/codex-chip/bootstrap.js.map +1 -0
- package/dist/commands/codex-chip/breakthrough-command.js +0 -7
- package/dist/commands/codex-chip/breakthrough-command.js.map +1 -1
- package/dist/commands/codex-chip/cleanup-command.js +1 -9
- package/dist/commands/codex-chip/cleanup-command.js.map +1 -1
- package/dist/commands/codex-chip/command.js +5 -63
- package/dist/commands/codex-chip/command.js.map +1 -1
- package/dist/commands/codex-chip/git.d.ts +0 -1
- package/dist/commands/codex-chip/git.js +0 -2
- package/dist/commands/codex-chip/git.js.map +1 -1
- package/dist/commands/codex-chip/goals.d.ts +9 -0
- package/dist/commands/codex-chip/goals.js +54 -7
- package/dist/commands/codex-chip/goals.js.map +1 -1
- package/dist/commands/codex-chip/help.d.ts +1 -1
- package/dist/commands/codex-chip/help.js +13 -24
- package/dist/commands/codex-chip/help.js.map +1 -1
- package/dist/commands/codex-chip/model.d.ts +2 -4
- package/dist/commands/codex-chip/model.js +1 -1
- package/dist/commands/codex-chip/model.js.map +1 -1
- package/dist/commands/codex-chip/naming.js +4 -10
- package/dist/commands/codex-chip/naming.js.map +1 -1
- package/dist/commands/codex-chip/native.js +11 -15
- package/dist/commands/codex-chip/native.js.map +1 -1
- package/dist/commands/codex-chip/prompt.d.ts +2 -1
- package/dist/commands/codex-chip/prompt.js +15 -59
- package/dist/commands/codex-chip/prompt.js.map +1 -1
- package/dist/commands/codex-chip/resume-command.js +0 -3
- package/dist/commands/codex-chip/resume-command.js.map +1 -1
- package/dist/commands/codex-chip/selection.d.ts +1 -1
- package/dist/commands/codex-chip/selection.js +15 -59
- package/dist/commands/codex-chip/selection.js.map +1 -1
- package/dist/commands/codex-chip/worker.js +60 -122
- package/dist/commands/codex-chip/worker.js.map +1 -1
- package/dist/commands/codex-delivery.d.ts +32 -7
- package/dist/commands/codex-delivery.js +76 -92
- package/dist/commands/codex-delivery.js.map +1 -1
- package/dist/commands/codex-startup.js +1 -1
- package/dist/commands/codex-startup.js.map +1 -1
- package/dist/commands/codex.js +36 -34
- package/dist/commands/codex.js.map +1 -1
- package/dist/commands/friction-reminder.d.ts +9 -9
- package/dist/commands/friction-reminder.js +12 -17
- package/dist/commands/friction-reminder.js.map +1 -1
- package/dist/commands/inbox-primer-reminder.js +3 -3
- package/dist/commands/inbox-primer-reminder.js.map +1 -1
- package/dist/commands/init.js +7 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/load-primer-reminder.js +2 -2
- package/dist/commands/load-primer-reminder.js.map +1 -1
- package/dist/commands/load.js +28 -27
- package/dist/commands/load.js.map +1 -1
- package/dist/commands/mechanic-spawn.d.ts +10 -0
- package/dist/commands/mechanic-spawn.js +67 -0
- package/dist/commands/mechanic-spawn.js.map +1 -0
- package/dist/commands/mechanic.js +6 -0
- package/dist/commands/mechanic.js.map +1 -1
- package/dist/commands/opencode-chip-client.d.ts +8 -0
- package/dist/commands/opencode-chip-client.js +45 -0
- package/dist/commands/opencode-chip-client.js.map +1 -0
- package/dist/commands/opencode-chip-lifecycle.d.ts +2 -0
- package/dist/commands/opencode-chip-lifecycle.js +137 -0
- package/dist/commands/opencode-chip-lifecycle.js.map +1 -0
- package/dist/commands/opencode-chip-mission.d.ts +22 -0
- package/dist/commands/opencode-chip-mission.js +105 -0
- package/dist/commands/opencode-chip-mission.js.map +1 -0
- package/dist/commands/opencode-chip-store.d.ts +72 -0
- package/dist/commands/opencode-chip-store.js +141 -0
- package/dist/commands/opencode-chip-store.js.map +1 -0
- package/dist/commands/opencode-chip.d.ts +3 -0
- package/dist/commands/opencode-chip.js +488 -0
- package/dist/commands/opencode-chip.js.map +1 -0
- package/dist/commands/opencode-goals.d.ts +5 -0
- package/dist/commands/opencode-goals.js +83 -0
- package/dist/commands/opencode-goals.js.map +1 -0
- package/dist/hook.js +8 -3
- package/dist/hook.js.map +1 -1
- package/dist/index.js +11 -90
- package/dist/index.js.map +1 -1
- package/dist/opencode-plugin.bundle.js +9 -11
- package/package.json +1 -1
- package/skill/greprag/SKILL.md +2 -2
- package/skill/greprag/docs/codex-chip.md +20 -59
- package/skill/greprag/docs/setup.md +15 -21
- package/skill/templates/chip-bootloader.md +33 -91
- package/skill/templates/chip-leader-opencode.md +90 -75
- package/skill/templates/chip-leader.md +81 -221
- package/skill/templates/codex-chip-spawn.md +129 -173
- package/skill/templates/codex-subagent-spawn.md +32 -0
- package/dist/commands/codex-native-delivery.d.ts +0 -70
- package/dist/commands/codex-native-delivery.js +0 -285
- package/dist/commands/codex-native-delivery.js.map +0 -1
- package/skill/templates/reflex-chip.md +0 -58
- package/skill/templates/workshop-chip.md +0 -46
|
@@ -1,107 +1,49 @@
|
|
|
1
1
|
# Chip Bootloader
|
|
2
2
|
|
|
3
|
-
No `spawn_task`?
|
|
4
|
-
there, and the bootloader takes over. greprag inbox is the back-channel.
|
|
3
|
+
No `spawn_task`? Use OpenCode Desktop HTTP spawn (preferred) or manual paste.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## Preferred: quick chip (path A)
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
The leader plans the integration branch, labels, seams, and merge order before
|
|
10
|
-
any chip launches. A lone chip proceeds directly below.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
## Lead: before presenting the bootloader
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
if [ -d "C:\chip-<slug>" ]; then
|
|
17
|
-
cd "C:\chip-<slug>"
|
|
18
|
-
current=$(git branch --show-current)
|
|
19
|
-
if [ "$current" = "chip/<slug>" ]; then
|
|
20
|
-
echo "Worktree already exists on correct branch — reusing"
|
|
21
|
-
else
|
|
22
|
-
echo "ERROR: Worktree dir exists but branch is '$current', not 'chip/<slug>'. Remove and retry." >&2
|
|
23
|
-
exit 1
|
|
24
|
-
fi
|
|
25
|
-
else
|
|
26
|
-
git worktree add C:\chip-<slug> -b chip/<slug>
|
|
27
|
-
fi
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
The worktree IS the isolation — same pattern as Claude Code's `spawn_task` worktree
|
|
31
|
-
landing. Branch already exists, directory already isolated. Now present the
|
|
32
|
-
bootloader below and tell the user: **"Open a new session here: C:\chip-<slug>"**
|
|
33
|
-
|
|
34
|
-
## After chip reports DONE
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
git checkout <target-branch> # main or integration branch
|
|
38
|
-
git merge chip/<slug>
|
|
39
|
-
git worktree remove C:\chip-<slug>
|
|
40
|
-
git branch -d chip/<slug>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
## Bootloader template
|
|
45
|
-
|
|
46
|
-
Substitute the bracketed placeholders and present as a copyable code block.
|
|
47
|
-
|
|
48
|
-
````
|
|
49
|
-
Chip <Label>: <verb-phrase>
|
|
50
|
-
|
|
51
|
-
You are inside C:\chip-<slug> — a git worktree on branch chip/<slug>,
|
|
52
|
-
created for you by the lead. Verify:
|
|
7
|
+
Initiator is LEAD — no separate LEAD session:
|
|
53
8
|
|
|
54
9
|
```bash
|
|
55
|
-
|
|
10
|
+
greprag opencode chip goal create \
|
|
11
|
+
--objective "…" --final-state "…" \
|
|
12
|
+
--criterion ship:… \
|
|
13
|
+
--owner-session <this-8hex> --owner-role leader
|
|
14
|
+
|
|
15
|
+
greprag opencode chip spawn \
|
|
16
|
+
--title "Purview Name" --role worker --label A \
|
|
17
|
+
--goal-id <id> --covers ship \
|
|
18
|
+
--task "…" \
|
|
19
|
+
--parent-session <ses_…> --parent-greprag <8hex> \
|
|
20
|
+
--model deepseek/deepseek-chat \
|
|
21
|
+
--opencode-url http://127.0.0.1:<port> \
|
|
22
|
+
--dispatch
|
|
23
|
+
# → "Chip A: Purview Name"
|
|
24
|
+
# close: report → goal accept → greprag opencode chip close <id|ses_>
|
|
56
25
|
```
|
|
57
26
|
|
|
58
|
-
|
|
59
|
-
## Block 1 — Setup
|
|
60
|
-
|
|
61
|
-
1. Get your session ID:
|
|
62
|
-
```bash
|
|
63
|
-
greprag status 2>&1 | grep -oP '(?<=greprag session id: )[0-9a-f]+'
|
|
64
|
-
```
|
|
27
|
+
## Multi-chip mission (path B)?
|
|
65
28
|
|
|
66
|
-
2
|
|
67
|
-
|
|
68
|
-
greprag send "IN-FLIGHT: chip/<slug> launched — <task-summary>" \
|
|
69
|
-
--to <handle>@greprag.com/<parent-8hex> \
|
|
70
|
-
--from-session <your-8hex>
|
|
71
|
-
```
|
|
29
|
+
≥2 chips at one objective → STOP → `greprag load chip-leader-opencode`
|
|
30
|
+
(PLANNER → LEAD → nested goal → Chip A/B).
|
|
72
31
|
|
|
73
|
-
|
|
32
|
+
## Manual paste (API down only)
|
|
74
33
|
|
|
75
|
-
|
|
76
|
-
|
|
34
|
+
### Block 1 — Setup
|
|
35
|
+
1. `greprag status` → 8-hex
|
|
36
|
+
2. `greprag send "IN-FLIGHT: <title>" --to travis@greprag.com/<parent-8hex>`
|
|
37
|
+
3. Branch `chip/<slug>`
|
|
38
|
+
4. Each turn: `greprag inbox --peek`
|
|
77
39
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Commit milestones on chip/<slug>. At each turn start, run
|
|
81
|
-
`greprag inbox --peek` — the lead may send new instructions.
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
## Block 2 — Report when done
|
|
40
|
+
### Task
|
|
41
|
+
\<work — include goal id + covers\>
|
|
85
42
|
|
|
43
|
+
### Block 2 — Report
|
|
86
44
|
```bash
|
|
87
|
-
greprag send "
|
|
88
|
-
|
|
89
|
-
--from-session <your-8hex>
|
|
45
|
+
greprag send "DONE: … | commit=<sha> | checks=…" --to travis@greprag.com/<parent-8hex>
|
|
46
|
+
# or BLOCKED: …
|
|
90
47
|
```
|
|
91
48
|
|
|
92
|
-
|
|
93
|
-
The lead will merge chip/<slug> and remove this worktree when finished.
|
|
94
|
-
````
|
|
95
|
-
|
|
96
|
-
### Placeholder reference
|
|
97
|
-
|
|
98
|
-
| Placeholder | Substitute |
|
|
99
|
-
|---|---|
|
|
100
|
-
| `<Label>` | Single-letter (A, B...) or omit for single-chip |
|
|
101
|
-
| `<verb-phrase>` | Short name, e.g. `Fix synthesis loop` |
|
|
102
|
-
| `<slug>` | Slugified — `fix-synthesis-loop` |
|
|
103
|
-
| `<parent-8hex>` | Your own session id (first 8 hex) |
|
|
104
|
-
| `<handle>` | Operator's greprag handle |
|
|
105
|
-
| `<task-summary>` | One-liner for the IN-FLIGHT ping |
|
|
106
|
-
| `<status>` | `DONE`, `BLOCKED`, `PARTIAL` |
|
|
107
|
-
| `<result>` | Summary of what was done |
|
|
49
|
+
Workers always `--label A|B|C…`. `--model` required. Report-back is greprag inbox.
|
|
@@ -1,98 +1,113 @@
|
|
|
1
|
-
# Chip Leader —
|
|
1
|
+
# Chip Leader — OpenCode multi-chip (path B)
|
|
2
2
|
|
|
3
|
-
> Loaded via `greprag load chip-leader-opencode`
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> Loaded via `greprag load chip-leader-opencode` when ≥2 chips share one objective.
|
|
4
|
+
> **One chip (or two independent ones)?** Skip this — use the **quick path** in
|
|
5
|
+
> `chip-bootloader` / `greprag opencode chip --help` (initiator is LEAD).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
who plans the whole mission *before* any worker deploys and reconciles them
|
|
9
|
-
*after*. Topology is a planning decision, not an execution afterthought — draw
|
|
10
|
-
the map before mobilizing the troops.
|
|
7
|
+
## Two paths (both first-class)
|
|
11
8
|
|
|
12
|
-
**
|
|
13
|
-
Launch-then-plan is the exact failure this prevents.
|
|
14
|
-
|
|
15
|
-
## Two modes — pick ONE before planning
|
|
16
|
-
|
|
17
|
-
Forks on one question: **do the chips share one objective, or are they independent?**
|
|
18
|
-
|
|
19
|
-
| | **Mode A — Mission** | **Mode B — Orchestrator** |
|
|
9
|
+
| | **A — Quick** | **B — Mission (this doc)** |
|
|
20
10
|
|---|---|---|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
Both modes share decompose, dispatch via bootloader, the label system, and the
|
|
28
|
-
merge discipline below.
|
|
29
|
-
|
|
30
|
-
## Phase 1 — Decompose
|
|
11
|
+
| When | 1 chip, or independent jobs | ≥2 chips, seams, one objective |
|
|
12
|
+
| Who is LEAD | **Initiator** (this session) | Explicit `LEAD:` chip |
|
|
13
|
+
| Goal | `goal create --owner-role leader` owned by this 8-hex | PLANNER goal → nested LEAD goal |
|
|
14
|
+
| Spawn | `worker --label A` (solo = A) | LEAD dispatches Chip A/B… |
|
|
15
|
+
| Close | Parent accept + `close` | LEAD reconciles → accept → close |
|
|
31
16
|
|
|
32
|
-
|
|
33
|
-
Assign each a **Label** (A, B, C...). The label is the shared handle the leader
|
|
34
|
-
and chip both use end-to-end: bootloader title → IN-FLIGHT ping → report-back
|
|
35
|
-
self-ID → merge references.
|
|
17
|
+
**Hard fire for B:** about to spawn the **2nd chip at one objective** → stop and plan here.
|
|
36
18
|
|
|
37
|
-
##
|
|
19
|
+
## Path A — Quick (default)
|
|
38
20
|
|
|
39
|
-
Create one branch off the default branch that all Mode A chips merge INTO:
|
|
40
21
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
greprag opencode chip goal create \
|
|
23
|
+
--objective "…" --final-state "…" \
|
|
24
|
+
--criterion ship:… \
|
|
25
|
+
--owner-session <this-greprag-8hex> \
|
|
26
|
+
--owner-role leader
|
|
27
|
+
|
|
28
|
+
greprag opencode chip spawn \
|
|
29
|
+
--title "Purview" --role worker --label A \
|
|
30
|
+
--goal-id <id> --covers ship \
|
|
31
|
+
--task "…" \
|
|
32
|
+
--parent-session <this-ses_…> \
|
|
33
|
+
--parent-greprag <this-8hex> \
|
|
34
|
+
--model deepseek/deepseek-chat \
|
|
35
|
+
--opencode-url http://127.0.0.1:<port> \
|
|
36
|
+
--dispatch
|
|
37
|
+
|
|
38
|
+
# later:
|
|
39
|
+
greprag opencode chip report <chip> --summary "…" --evidence ship:…
|
|
40
|
+
greprag opencode chip goal accept <id> --owner-session <this-8hex> --summary "…"
|
|
41
|
+
greprag opencode chip close <chip> --summary "…"
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
integration branch. When the chip reports DONE, its work is ON `chip/<slug>`,
|
|
47
|
-
ready to merge into `feature/<slug>`.
|
|
44
|
+
No separate LEAD chip. No bind-lead. Initiator owns the goal and closeout.
|
|
48
45
|
|
|
49
|
-
##
|
|
46
|
+
## Path B — Mission flow
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
1. **PLANNER** creates the mission goal (`--owner-role planner`).
|
|
49
|
+
2. Spawn **one LEAD** under that goal (`--role leader --covers …`).
|
|
50
|
+
3. LEAD creates a **nested** goal + bind:
|
|
54
51
|
```bash
|
|
55
|
-
|
|
52
|
+
greprag opencode chip goal create \
|
|
53
|
+
--objective "…" --final-state "…" \
|
|
54
|
+
--criterion ship:… \
|
|
55
|
+
--owner-session <lead-child-greprag-8hex> \
|
|
56
|
+
--owner-role leader \
|
|
57
|
+
--parent-goal-id <planner-goal-id>
|
|
58
|
+
greprag opencode chip bind-lead <lead-chip-id> \
|
|
59
|
+
--goal-id <nested-goal-id> \
|
|
60
|
+
--owner-session <lead-child-greprag-8hex>
|
|
56
61
|
```
|
|
62
|
+
4. LEAD spawns workers against the **nested** goal:
|
|
63
|
+
`--role worker --label A --title "…" --goal-id <nested> --covers ship --parent-greprag <lead-8hex>`.
|
|
64
|
+
5. Workers: `IN-FLIGHT` → work → `DONE`/`BLOCKED`. Parent: `report --evidence …`.
|
|
65
|
+
6. Accept nested goal, then planner goal; then `close` chips.
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
- Label: `Chip A: <verb-phrase>`
|
|
60
|
-
- Integration branch name in the task (Mode A)
|
|
61
|
-
- One clear, self-contained task per chip
|
|
67
|
+
## Role titles (exact)
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
> Open a new session here: C:\\chip-<slug>
|
|
69
|
+
`PLANNER: …` · `LEAD: …` · `Chip A: …` / `Chip B: …` · `ADVISOR: …` · `MECHANIC: …`
|
|
65
70
|
|
|
66
|
-
|
|
71
|
+
Workers **always** `--label A|B|C…` (solo = A). Never bare `Chip:`.
|
|
67
72
|
|
|
68
|
-
##
|
|
73
|
+
## Mode A vs Mode B topology (still for path B)
|
|
69
74
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
2. Resolve any seam conflicts between chips
|
|
76
|
-
3. Run the full feature end-to-end on `feature/<slug>`
|
|
77
|
-
4. One reviewed merge to master, then prune:
|
|
78
|
-
```bash
|
|
79
|
-
git checkout master
|
|
80
|
-
git merge feature/<slug>
|
|
81
|
-
git branch -d feature/<slug>
|
|
82
|
-
# for each chip:
|
|
83
|
-
git worktree remove C:\\chip-<chip-slug>
|
|
84
|
-
git branch -d chip/<chip-slug>
|
|
85
|
-
```
|
|
75
|
+
| | **Mission topology** | **Orchestrator topology** |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| When | ≥2 chips, one objective | Independent issues |
|
|
78
|
+
| Branch | Integration branch | Per-chip / per-repo |
|
|
79
|
+
| Gate | One reviewed merge to master | Per-chip verify |
|
|
86
80
|
|
|
87
|
-
##
|
|
81
|
+
## Spawn flags (canonical)
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
```bash
|
|
84
|
+
greprag opencode chip spawn \
|
|
85
|
+
--title "Auth Middleware" \
|
|
86
|
+
--role worker --label A \
|
|
87
|
+
--goal-id <id> --covers ship \
|
|
88
|
+
--task "…" \
|
|
89
|
+
--parent-session <ses_…> \
|
|
90
|
+
--parent-greprag <8hex> \
|
|
91
|
+
--model deepseek/deepseek-chat \
|
|
92
|
+
--opencode-url http://127.0.0.1:<port> \
|
|
93
|
+
--dispatch
|
|
94
|
+
# → "Chip A: Auth Middleware"
|
|
95
|
+
```
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
Close: `greprag opencode chip close <chipId|ses_> --summary "…"`
|
|
98
|
+
(`--keep-session` · `--force` · `--keep-open-goal`)
|
|
93
99
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
- **`--model` required** (Desktop defaults can 401).
|
|
101
|
+
- **`--top-level`** if you need a session-list entry without nesting.
|
|
102
|
+
- Desktop **does not auto-focus** API-created sessions.
|
|
103
|
+
|
|
104
|
+
## Isolation
|
|
105
|
+
|
|
106
|
+
Prefer `chip/<slug>` branch per chip. Records: `~/.greprag/opencode-chips/`. Goals: `~/.greprag/chip-goals/`.
|
|
107
|
+
|
|
108
|
+
## Do not
|
|
109
|
+
|
|
110
|
+
- Force path B for a single chip — use path A.
|
|
111
|
+
- Dispatch workers from a **planner** goal (planner accepts LEAD only).
|
|
112
|
+
- Skip IN-FLIGHT or end without DONE/BLOCKED.
|
|
113
|
+
- Use Codex `create_thread` / Claude `spawn_task` here — wrong harness.
|
|
@@ -1,223 +1,83 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Two modes — pick ONE before planning
|
|
53
|
-
|
|
54
|
-
Forks on one question: **do the chips share one objective, or are they independent?**
|
|
55
|
-
|
|
56
|
-
| | **Mode A — Mission** | **Mode B — Orchestrator** |
|
|
57
|
-
|---|---|---|
|
|
58
|
-
| **When** | ≥2 chips at ONE objective, usually ONE repo | N independent issues, often DIFFERENT repos |
|
|
59
|
-
| **Relationship** | chips have seams — shared files, data contracts, ordering | disjoint by construction — no seams |
|
|
60
|
-
| **Branching** | one integration branch `feature/<slug>`; chips base off it, merge into it | each chip self-contained in its OWN repo; no integration branch |
|
|
61
|
-
| **Merge** | leader reconciles all → ONE reviewed merge to master | each chip merges to ITS OWN repo's default, independently |
|
|
62
|
-
| **Gate** | whole feature run end-to-end on the integration worktree | per-chip verification; no cross-chip gate |
|
|
63
|
-
| **Leader's core job** | merge-reconciliation across seams | **dispatch + completion judgment** — chips report back, you adjudicate |
|
|
64
|
-
|
|
65
|
-
Both modes share decompose, dispatch (via `greprag load chip-spawn`), the label
|
|
66
|
-
discipline, and the single-watcher rule. They diverge on topology and the back
|
|
67
|
-
half (reconcile vs. adjudicate).
|
|
68
|
-
|
|
69
|
-
## Mode A — Mission
|
|
70
|
-
|
|
71
|
-
### The invariant that drives everything
|
|
72
|
-
|
|
73
|
-
`master` is the production trunk — `git push origin master` deploys. So:
|
|
74
|
-
- **Merged = ships on the next deploy.** A flag gates *behavior*, not *startup
|
|
75
|
-
code*: schema/migration statements and import-time side effects run regardless
|
|
76
|
-
of any feature flag. "Flag-gated" ≠ "inert on master."
|
|
77
|
-
- **Chips NEVER merge directly to master.** They reconcile on a feature
|
|
78
|
-
integration branch. Master only ever holds verified, deployable work.
|
|
79
|
-
- One objective → **one integration branch** → **one reviewed merge to master**.
|
|
80
|
-
|
|
81
|
-
### Phase 1 — Decompose
|
|
82
|
-
|
|
83
|
-
Break the objective into workstreams (one per chip). For each, name:
|
|
84
|
-
- **Label** — a stable letter (`A`, `B`, `C`…). It becomes the chip's title prefix
|
|
85
|
-
(`Chip A: <verb>`) and the one handle you *and* the chip use end-to-end (title,
|
|
86
|
-
report-back self-ID, merge log). Letters, not numbers — workstream IDs, not an
|
|
87
|
-
execution order.
|
|
88
|
-
- **Parallel or sequential** — can it run independently, or need another's output?
|
|
89
|
-
- **Seams** — every place two workstreams touch: *shared file* (both edit the same
|
|
90
|
-
module → serialize at merge), *data contract* (one produces what another consumes
|
|
91
|
-
→ producer merges first), *ordering dependency* (B meaningless until A lands).
|
|
92
|
-
- Disjoint workstreams (no shared file, no contract) → merge in any order.
|
|
93
|
-
|
|
94
|
-
Output the plan explicitly and **confirm it with the user before dispatching.**
|
|
95
|
-
|
|
96
|
-
### Phase 2 — Topology
|
|
97
|
-
|
|
98
|
-
Detect the default branch first (`git -C <main> symbolic-ref refs/remotes/origin/HEAD`
|
|
99
|
-
→ strip prefix; fallback `master`), then:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
git -C <main> worktree add .claude/worktrees/feature-<slug> -b feature/<slug> <default>
|
|
1
|
+
# Leader Mission
|
|
2
|
+
|
|
3
|
+
Load this method when the work needs a dedicated orchestrator: more than the
|
|
4
|
+
quick 1–2 visible chips, shared files or contracts, ordering, integration, or
|
|
5
|
+
another coordination seam.
|
|
6
|
+
|
|
7
|
+
## Identity first
|
|
8
|
+
|
|
9
|
+
Before any child is created, the orchestrating task becomes the dedicated
|
|
10
|
+
leader by renaming itself exactly:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
LEAD: <Mission>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Children use the exact ordinal discoverability schema:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
Chip A: <Specific Purview>
|
|
20
|
+
Chip B: <Specific Purview>
|
|
21
|
+
Chip C: <Specific Purview>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Naming identifies the workstream and makes the task legible. It does not grant
|
|
25
|
+
execution authority; every child remains an ordinary writable chip.
|
|
26
|
+
|
|
27
|
+
## Quick versus Leader
|
|
28
|
+
|
|
29
|
+
- **Quick:** the current task renames itself `LEAD: <Mission>` and directly
|
|
30
|
+
spawns 1–2 children. No separate leader task is created.
|
|
31
|
+
- **Leader:** the initiator creates a separate `LEAD: <Mission>` task. That
|
|
32
|
+
dedicated task owns decomposition, child dispatch, seam reconciliation,
|
|
33
|
+
checks, integration, parent messaging, and cleanup.
|
|
34
|
+
|
|
35
|
+
This template is for the second shape. If the mission fits the quick shape,
|
|
36
|
+
load `greprag load codex-chip-spawn` and keep the initiator as the implicit
|
|
37
|
+
LEAD.
|
|
38
|
+
|
|
39
|
+
## Mission worksheet
|
|
40
|
+
|
|
41
|
+
Before dispatch, record:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Mission: <observable outcome>
|
|
45
|
+
Integration target: <branch/worktree or parent review point>
|
|
46
|
+
Chip A: <Specific Purview> — <dependency/seam>
|
|
47
|
+
Chip B: <Specific Purview> — <dependency/seam>
|
|
48
|
+
Chip C: <Specific Purview> — <dependency/seam>
|
|
49
|
+
Order: <parallel work, then required reconciliation order>
|
|
50
|
+
Checks: <whole-mission verification>
|
|
51
|
+
Closeout: <who integrates and cleans each worktree>
|
|
103
52
|
```
|
|
104
53
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
### Phase 4 — Reconcile + integrate
|
|
136
|
-
|
|
137
|
-
As chips report `DONE`:
|
|
138
|
-
1. **Merge into `feature/<slug>` in the planned order** (`--no-ff`, from the
|
|
139
|
-
integration worktree). Seam-sharers: base first, then the dependent.
|
|
140
|
-
2. **On conflict at a seam** — expected; resolve it (you mapped it in Phase 1). On
|
|
141
|
-
an *unexpected* conflict, stop and re-examine the decomposition.
|
|
142
|
-
3. **Recommend closing the chip out** as soon as its commits are reconciled (or
|
|
143
|
-
even just committed + reported) — the branch survives the session; you need the
|
|
144
|
-
branch, not the live session, to merge later. Don't wait to be asked.
|
|
145
|
-
4. **Run the full feature end-to-end on the integration worktree** — the gate.
|
|
146
|
-
5. **One reviewed merge to master, then clean up.** Only after the gate passes:
|
|
147
|
-
`feature/<slug>` → master, then deploy. Then sweep the worktrees (the cleanup
|
|
148
|
-
skill keys on "merged into master," so it won't remove chips until then).
|
|
149
|
-
|
|
150
|
-
**PRUNE AT THE MERGE (HARD RULE).** Each chip's *worktree* dies the moment its
|
|
151
|
-
branch merges into its target — same breath, never batched. The *branch* is the
|
|
152
|
-
safety net and lives until the master merge. Stale worktrees pile up precisely
|
|
153
|
-
because cleanup was deferred.
|
|
154
|
-
|
|
155
|
-
## Mode B — Orchestrator (independent fan-out, cross-repo)
|
|
156
|
-
|
|
157
|
-
A list of independent issues, each self-contained in its own repo. Nothing to
|
|
158
|
-
integrate — every chip lives and ships on its own. Your job is **dispatch +
|
|
159
|
-
completion judgment**: each chip reports back because you hold the "done"
|
|
160
|
-
criterion.
|
|
161
|
-
|
|
162
|
-
### B1 — Decompose AND screen
|
|
163
|
-
|
|
164
|
-
One chip per issue — but **screen each candidate first; not every issue is a
|
|
165
|
-
chip.** A chip must be a self-contained coding task in a clean git repo. Drop the
|
|
166
|
-
rest and say why: interactive-with-operator (needs his login/judgment), ops/comms
|
|
167
|
-
(submissions, third-party coordination, email), cross-repo config writes (e.g.
|
|
168
|
-
editing a skill under `~/.claude` — not a clean worktree target; do inline),
|
|
169
|
-
operator-owned manual tasks. (Reporting "none of these are chips" is a correct,
|
|
170
|
-
useful result.)
|
|
171
|
-
|
|
172
|
-
For each survivor record: **Label** (`A`/`B`/`C`…), **Target repo** (its root,
|
|
173
|
-
from `~/.greprag/projects.json` → becomes the chip's `cwd`), **Completion
|
|
174
|
-
criterion** (what "done" means, in YOUR words — you'll judge against it).
|
|
175
|
-
|
|
176
|
-
Output the screened plan (chips + dropped non-chips with reasons); confirm before
|
|
177
|
-
dispatch.
|
|
178
|
-
|
|
179
|
-
### B2 — Topology: none shared
|
|
180
|
-
|
|
181
|
-
No integration branch. Each chip: **cwd** = its own repo root; **base branch** =
|
|
182
|
-
that repo's own default (detect per-repo); **merge target** = that repo's default,
|
|
183
|
-
or hold-for-review (default to hold so you adjudicate before anything ships).
|
|
184
|
-
|
|
185
|
-
### B3 — Dispatch
|
|
186
|
-
|
|
187
|
-
Spawn each via `greprag load chip-spawn` with: `cwd` set; Block 1 worktree off the
|
|
188
|
-
repo's default; the label discipline; Block 2 reporting to **your** session; the
|
|
189
|
-
**completion criterion embedded in the brief**. Arm ONE watcher. Re-dispatch
|
|
190
|
-
discipline (cancel-before-respawn) identical to Mode A.
|
|
191
|
-
|
|
192
|
-
### B4 — Adjudicate (replaces reconcile)
|
|
193
|
-
|
|
194
|
-
As each chip reports `DONE`: **verify against the criterion** (read the diff, run
|
|
195
|
-
it if needed — don't take "DONE" on faith); **decide per chip** (merge to its own
|
|
196
|
-
repo's default + deploy, or send back with specifics); **surface close-out per
|
|
197
|
-
chip** as it lands. No single end-of-mission master merge — N independent ones.
|
|
198
|
-
|
|
199
|
-
## Safety rules
|
|
200
|
-
|
|
201
|
-
- **Never spawn the 2nd chip without picking a mode + planning.** Mode A for one
|
|
202
|
-
shared objective; Mode B for independent issues.
|
|
203
|
-
- **Mode B: screen before you spawn.** Interactive, ops/comms, cross-repo-config,
|
|
204
|
-
operator-owned tasks are NOT chips.
|
|
205
|
-
- **Never spawn a chip while a stale one for the same workstream is in flight —
|
|
206
|
-
CANCEL first.** `spawn_task` is a stateful commitment.
|
|
207
|
-
- **Mode A: never merge a chip branch to master.** Integration branch only.
|
|
208
|
-
- **Never let "it's flag-gated" justify merging untested work to master.**
|
|
209
|
-
Migrations and startup code ignore feature flags.
|
|
210
|
-
- **Confirm the decomposition with the user before dispatch.** Wrong seams =
|
|
211
|
-
painful merges.
|
|
212
|
-
- **Surface close-out proactively** as each chip reconciles.
|
|
213
|
-
|
|
214
|
-
## Execution depth (advanced)
|
|
215
|
-
|
|
216
|
-
Orthogonal to mode: each workstream also picks a *vehicle* — bare subagent, a
|
|
217
|
-
leader-direct workflow, a simple chip, or an **orchestrator chip** (a lean chip
|
|
218
|
-
running an inner workflow swarm in its own worktree, for mixed-model missions
|
|
219
|
-
needing isolation + a human gate). Mixed-model work cannot be a simple chip
|
|
220
|
-
(`spawn_task` has no model param → chips are session-locked). Don't over-stack: a
|
|
221
|
-
one-file fix gets a subagent, not a three-tier hierarchy. If you need the
|
|
222
|
-
orchestrator-chip brief addendum or the recovery recipe for a chip mistakenly
|
|
223
|
-
merged to master, ask the operator — those live in the chip-leader skill docs.
|
|
54
|
+
Give each child one clear purview. Explain shared files, contracts, and
|
|
55
|
+
ordering in the brief rather than relying on hidden coordination metadata.
|
|
56
|
+
|
|
57
|
+
## Dispatch and closeout
|
|
58
|
+
|
|
59
|
+
1. Rename the leader task before the first child spawn.
|
|
60
|
+
2. Spawn each `Chip A/B/C: <Specific Purview>` with its own visible worktree
|
|
61
|
+
and the mission context it needs.
|
|
62
|
+
A child titled exactly `MECHANIC: <Mission>` must make `greprag load mechanic`
|
|
63
|
+
its first Setup action before diagnosis or edits.
|
|
64
|
+
3. Keep children writable and let them investigate, edit, test, and commit
|
|
65
|
+
within their worktrees.
|
|
66
|
+
4. Require each child to return `DONE` or `BLOCKED` through the native
|
|
67
|
+
parent-child task result, including the commit, checks, and caveats. Use
|
|
68
|
+
`greprag send` only for explicit cross-harness or peer messaging:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
greprag send "Chip A update — <commit> — <checks/caveats>" \
|
|
72
|
+
--to <handle>@greprag.com/<parent-session> \
|
|
73
|
+
--from-session <child-session>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
5. Review reports, reconcile seams in the planned order, run the whole-mission
|
|
77
|
+
checks, and send the parent a concise closeout.
|
|
78
|
+
6. The parent owns integration and cleanup. Do not silently delete a child
|
|
79
|
+
worktree or treat a report as acceptance.
|
|
80
|
+
|
|
81
|
+
Do not introduce a separate read-only, lease, nested-goal, or delivery-proof
|
|
82
|
+
layer just to make the mission look formal. The durable boundaries are the
|
|
83
|
+
visible names, isolated worktrees, reports, `greprag send`, and cleanup.
|