greprag 5.60.4 → 5.60.6
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 +29 -153
- 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 +12 -0
- package/dist/commands/codex-chip/bootstrap.js +114 -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 +21 -11
- package/dist/commands/codex-chip/cleanup-command.js.map +1 -1
- package/dist/commands/codex-chip/command.js +27 -49
- package/dist/commands/codex-chip/command.js.map +1 -1
- package/dist/commands/codex-chip/git.d.ts +19 -4
- package/dist/commands/codex-chip/git.js +82 -14
- package/dist/commands/codex-chip/git.js.map +1 -1
- package/dist/commands/codex-chip/goals.d.ts +9 -9
- package/dist/commands/codex-chip/goals.js +33 -73
- 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 +14 -25
- package/dist/commands/codex-chip/help.js.map +1 -1
- package/dist/commands/codex-chip/lifecycle.d.ts +4 -1
- package/dist/commands/codex-chip/lifecycle.js +14 -3
- package/dist/commands/codex-chip/lifecycle.js.map +1 -1
- package/dist/commands/codex-chip/model.d.ts +5 -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 -19
- 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 +20 -57
- package/dist/commands/codex-chip/prompt.js.map +1 -1
- package/dist/commands/codex-chip/resume-command.js +1 -4
- package/dist/commands/codex-chip/resume-command.js.map +1 -1
- package/dist/commands/codex-chip/selection.js +14 -55
- package/dist/commands/codex-chip/selection.js.map +1 -1
- package/dist/commands/codex-chip/worker.js +114 -44
- 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-watch-health.d.ts +11 -0
- package/dist/commands/codex-watch-health.js +54 -0
- package/dist/commands/codex-watch-health.js.map +1 -1
- package/dist/commands/codex.js +39 -33
- 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-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.js +19 -0
- package/dist/commands/opencode-chip-mission.js.map +1 -1
- package/dist/commands/opencode-chip-store.d.ts +19 -1
- package/dist/commands/opencode-chip-store.js.map +1 -1
- package/dist/commands/opencode-chip.js +30 -13
- package/dist/commands/opencode-chip.js.map +1 -1
- 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 +5 -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 -64
- package/skill/greprag/docs/setup.md +15 -21
- package/skill/mechanic/SKILL.md +24 -0
- package/skill/templates/chip-bootloader.md +15 -10
- package/skill/templates/chip-leader-opencode.md +64 -50
- package/skill/templates/chip-leader.md +81 -221
- package/skill/templates/codex-chip-spawn.md +150 -174
- 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
|
@@ -56,21 +56,17 @@ but turns are not saving, the most likely cause is untrusted hooks or an old
|
|
|
56
56
|
session that started before trust. Tell the user to open Codex Desktop Settings
|
|
57
57
|
-> Settings -> Hooks, trust the GrepRAG commands, and restart Codex.
|
|
58
58
|
|
|
59
|
-
Codex live inbox delivery
|
|
60
|
-
startup helper above. For foreground/manual testing:
|
|
59
|
+
Codex live inbox delivery uses the startup watcher. Public installs should use
|
|
60
|
+
the startup helper above. For foreground/manual testing:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
greprag codex watch --session <8hex-or-full-codex-session-id>
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
If `--session` is omitted, it uses the latest Codex session recorded in
|
|
67
|
-
`~/.codex/session_index.jsonl`.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
visible `BREAKTHROUGH_ACK:<nonce>` output; persisted history or an empty turn is
|
|
71
|
-
not delivery. `codex exec resume <session> -` can append to Codex's thread store,
|
|
72
|
-
but it is not a reliable visible wake in the active Desktop pane and must be
|
|
73
|
-
treated as fallback/diagnostic only.
|
|
67
|
+
`~/.codex/session_index.jsonl`. `greprag send` persists messages; the startup
|
|
68
|
+
watcher drains unread messages + SSE and performs target-local task delivery.
|
|
69
|
+
Turn hooks surface stored unread messages at Codex turn/tool/session boundaries.
|
|
74
70
|
Use `greprag codex startup status` to inspect the login entry and
|
|
75
71
|
`greprag codex startup remove` to uninstall it.
|
|
76
72
|
|
|
@@ -83,18 +79,16 @@ On Windows, the watcher should run hidden. If the user sees a persistent
|
|
|
83
79
|
`greprag codex startup install` to replace it with the hidden launcher. Logs
|
|
84
80
|
live at `~/.greprag/logs/codex-watch.log`.
|
|
85
81
|
|
|
86
|
-
`codex-notify` and `codex-inbox` remain
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
app-layer path is available. Do not enable unsafe sandbox bypass as a public
|
|
97
|
-
default.
|
|
82
|
+
`codex-notify` and `codex-inbox` remain turn-boundary steering. `greprag send`
|
|
83
|
+
always stores the ordinary message first. If the recipient task is live, use
|
|
84
|
+
native Codex task messaging to wake it and have that peer read/reply; if it is
|
|
85
|
+
not live, the row remains available for the next prompt. Only the recipient's
|
|
86
|
+
actual peer response proves delivery.
|
|
87
|
+
|
|
88
|
+
Target-local task delivery and command execution are separate checks. The
|
|
89
|
+
watcher can deliver stored work while the local Codex sandbox is unhealthy. On
|
|
90
|
+
native Windows, this can appear as `windows sandbox: spawn setup refresh`. Do
|
|
91
|
+
not enable unsafe sandbox bypass as a public default.
|
|
98
92
|
|
|
99
93
|
## claude-code
|
|
100
94
|
|
package/skill/mechanic/SKILL.md
CHANGED
|
@@ -61,6 +61,30 @@ Same gate the hourly compactor applies at write-time — Mechanic and compactor
|
|
|
61
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.
|
|
62
62
|
- **Harness scope is mandatory.** Friction carries its source harness (`claude-code`, `codex`, `opencode`). Repairs to hooks/skills/watchers must target that harness with `greprag mechanic install ... --harness <name>`. In a Codex session, default to `--harness codex`; use `--harness all` only for deliberately portable mechanisms.
|
|
63
63
|
|
|
64
|
+
## Codex Mechanic chip handoff
|
|
65
|
+
|
|
66
|
+
When this method is loaded inside a Codex task whose visible title is
|
|
67
|
+
`MECHANIC: <Mission>`, the harness is **Codex** and the task is already a
|
|
68
|
+
visible, ordinary writable Mechanic chip. Its scope is root-cause repair in the
|
|
69
|
+
Codex-provided checkout: inspect the live hooks/CLI, implement the reusable
|
|
70
|
+
repair, test it, commit it, and report DONE or BLOCKED to the parent. Do not
|
|
71
|
+
create another child or use an internal subagent unless the parent explicitly
|
|
72
|
+
changes that assignment.
|
|
73
|
+
|
|
74
|
+
The Codex control points are: native task/thread identity; the Codex-provided
|
|
75
|
+
worktree and cwd; the initial UserPromptSubmit binding; SessionStart/PostToolUse
|
|
76
|
+
context; and native parent-child completion. Preserve those boundaries while
|
|
77
|
+
repairing them--never silently turn the chip into a same-session subagent.
|
|
78
|
+
|
|
79
|
+
ABOUT TO dispatch or replace a visible Codex chip? STOP — load
|
|
80
|
+
`codex-chip-spawn` first and create the child with Codex Desktop's native
|
|
81
|
+
`codex_app__create_thread` project worktree target. For 1–2 children the current
|
|
82
|
+
task is the implicit LEAD; for more than two children or shared seams, load
|
|
83
|
+
`chip-leader` and create a separate `LEAD: <Mission>` that dispatches exact
|
|
84
|
+
`Chip A/B/C: <Specific Purview>` tasks.
|
|
85
|
+
`multi_agent_v1__spawn_agent` is only an ephemeral same-session subagent and
|
|
86
|
+
never satisfies a visible-chip requirement.
|
|
87
|
+
|
|
64
88
|
## Phase 0 — Fix digestion
|
|
65
89
|
|
|
66
90
|
A fix is a raw, undigested signal. Auto-detected friction fixes carry a type; hand-dropped ones are freeform. Digestion does two jobs per fix — **repair** the mechanism and/or **record** the durable gotcha — and runs FIRST.
|
|
@@ -2,27 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
No `spawn_task`? Use OpenCode Desktop HTTP spawn (preferred) or manual paste.
|
|
4
4
|
|
|
5
|
-
## Preferred:
|
|
5
|
+
## Preferred: quick chip (path A)
|
|
6
|
+
|
|
7
|
+
Initiator is LEAD — no separate LEAD session:
|
|
6
8
|
|
|
7
9
|
```bash
|
|
10
|
+
greprag opencode chip goal create \
|
|
11
|
+
--objective "…" --final-state "…" \
|
|
12
|
+
--criterion ship:… \
|
|
13
|
+
--owner-session <this-8hex> --owner-role leader
|
|
14
|
+
|
|
8
15
|
greprag opencode chip spawn \
|
|
9
16
|
--title "Purview Name" --role worker --label A \
|
|
10
|
-
--goal-id <id> --covers
|
|
17
|
+
--goal-id <id> --covers ship \
|
|
11
18
|
--task "…" \
|
|
12
19
|
--parent-session <ses_…> --parent-greprag <8hex> \
|
|
13
20
|
--model deepseek/deepseek-chat \
|
|
14
21
|
--opencode-url http://127.0.0.1:<port> \
|
|
15
22
|
--dispatch
|
|
16
|
-
# → "Chip A: Purview Name"
|
|
17
|
-
# close: greprag opencode chip close <id|ses_>
|
|
23
|
+
# → "Chip A: Purview Name"
|
|
24
|
+
# close: report → goal accept → greprag opencode chip close <id|ses_>
|
|
18
25
|
```
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
Fallback paste body + isolation notes: [docs/chip-bootloader-opencode.md](../../../docs/chip-bootloader-opencode.md)
|
|
22
|
-
|
|
23
|
-
## Multi-chip?
|
|
27
|
+
## Multi-chip mission (path B)?
|
|
24
28
|
|
|
25
|
-
≥2 chips at one objective → STOP → `greprag load chip-leader-opencode`
|
|
29
|
+
≥2 chips at one objective → STOP → `greprag load chip-leader-opencode`
|
|
30
|
+
(PLANNER → LEAD → nested goal → Chip A/B).
|
|
26
31
|
|
|
27
32
|
## Manual paste (API down only)
|
|
28
33
|
|
|
@@ -41,4 +46,4 @@ greprag send "DONE: … | commit=<sha> | checks=…" --to travis@greprag.com/<pa
|
|
|
41
46
|
# or BLOCKED: …
|
|
42
47
|
```
|
|
43
48
|
|
|
44
|
-
`--model` required. Report-back is greprag inbox
|
|
49
|
+
Workers always `--label A|B|C…`. `--model` required. Report-back is greprag inbox.
|
|
@@ -1,32 +1,53 @@
|
|
|
1
|
-
# Chip Leader — OpenCode multi-chip (
|
|
1
|
+
# Chip Leader — OpenCode multi-chip (path B)
|
|
2
2
|
|
|
3
|
-
> Loaded via `greprag load chip-leader-opencode
|
|
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).
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Two paths (both first-class)
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
| | **A — Quick** | **B — Mission (this doc)** |
|
|
10
|
+
|---|---|---|
|
|
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 |
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
**Hard fire for B:** about to spawn the **2nd chip at one objective** → stop and plan here.
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Path A — Quick (default)
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| `MECHANIC: <Purview>` | mechanic | Live friction; not routine execution |
|
|
21
|
+
```bash
|
|
22
|
+
greprag opencode chip goal create \
|
|
23
|
+
--objective "…" --final-state "…" \
|
|
24
|
+
--criterion ship:… \
|
|
25
|
+
--owner-session <this-greprag-8hex> \
|
|
26
|
+
--owner-role leader
|
|
24
27
|
|
|
25
|
-
|
|
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 "…"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
No separate LEAD chip. No bind-lead. Initiator owns the goal and closeout.
|
|
45
|
+
|
|
46
|
+
## Path B — Mission flow
|
|
26
47
|
|
|
27
48
|
1. **PLANNER** creates the mission goal (`--owner-role planner`).
|
|
28
|
-
2. Spawn **one LEAD** under that goal (`--role leader --covers …`).
|
|
29
|
-
3. LEAD creates a **nested** goal:
|
|
49
|
+
2. Spawn **one LEAD** under that goal (`--role leader --covers …`).
|
|
50
|
+
3. LEAD creates a **nested** goal + bind:
|
|
30
51
|
```bash
|
|
31
52
|
greprag opencode chip goal create \
|
|
32
53
|
--objective "…" --final-state "…" \
|
|
@@ -40,25 +61,24 @@ Wrapped by: **`greprag opencode chip spawn`** (prepare or `--dispatch`).
|
|
|
40
61
|
```
|
|
41
62
|
4. LEAD spawns workers against the **nested** goal:
|
|
42
63
|
`--role worker --label A --title "…" --goal-id <nested> --covers ship --parent-greprag <lead-8hex>`.
|
|
43
|
-
5. Workers: `IN-FLIGHT` → work → `DONE`/`BLOCKED`. Parent
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
(`--force` / `--keep-open-goal` escape hatches; `--keep-session` leaves Desktop tab)
|
|
64
|
+
5. Workers: `IN-FLIGHT` → work → `DONE`/`BLOCKED`. Parent: `report --evidence …`.
|
|
65
|
+
6. Accept nested goal, then planner goal; then `close` chips.
|
|
66
|
+
|
|
67
|
+
## Role titles (exact)
|
|
68
|
+
|
|
69
|
+
`PLANNER: …` · `LEAD: …` · `Chip A: …` / `Chip B: …` · `ADVISOR: …` · `MECHANIC: …`
|
|
50
70
|
|
|
51
|
-
|
|
71
|
+
Workers **always** `--label A|B|C…` (solo = A). Never bare `Chip:`.
|
|
52
72
|
|
|
53
|
-
|
|
73
|
+
## Mode A vs Mode B topology (still for path B)
|
|
74
|
+
|
|
75
|
+
| | **Mission topology** | **Orchestrator topology** |
|
|
54
76
|
|---|---|---|
|
|
55
77
|
| When | ≥2 chips, one objective | Independent issues |
|
|
56
|
-
| Branch | Integration branch
|
|
78
|
+
| Branch | Integration branch | Per-chip / per-repo |
|
|
57
79
|
| Gate | One reviewed merge to master | Per-chip verify |
|
|
58
80
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Spawn command (canonical)
|
|
81
|
+
## Spawn flags (canonical)
|
|
62
82
|
|
|
63
83
|
```bash
|
|
64
84
|
greprag opencode chip spawn \
|
|
@@ -69,31 +89,25 @@ greprag opencode chip spawn \
|
|
|
69
89
|
--parent-session <ses_…> \
|
|
70
90
|
--parent-greprag <8hex> \
|
|
71
91
|
--model deepseek/deepseek-chat \
|
|
72
|
-
--opencode-url http://127.0.0.1:<
|
|
92
|
+
--opencode-url http://127.0.0.1:<port> \
|
|
73
93
|
--dispatch
|
|
74
|
-
#
|
|
75
|
-
# multi-chip: --multi-chip --label B --title "Other Purview" → Chip B: …
|
|
94
|
+
# → "Chip A: Auth Middleware"
|
|
76
95
|
```
|
|
77
96
|
|
|
78
|
-
Close
|
|
79
|
-
|
|
80
|
-
greprag opencode chip close <chipId|ses_…> --summary "merged + verified"
|
|
81
|
-
# --keep-session to leave the Desktop session
|
|
82
|
-
```
|
|
97
|
+
Close: `greprag opencode chip close <chipId|ses_> --summary "…"`
|
|
98
|
+
(`--keep-session` · `--force` · `--keep-open-goal`)
|
|
83
99
|
|
|
84
|
-
- **
|
|
85
|
-
- **`--
|
|
86
|
-
-
|
|
87
|
-
- Desktop **does not auto-focus** API-created sessions — open session list / cycle children after spawn.
|
|
88
|
-
- Auth: `OPENCODE_SERVER_USERNAME` + `OPENCODE_SERVER_PASSWORD`.
|
|
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.
|
|
89
103
|
|
|
90
104
|
## Isolation
|
|
91
105
|
|
|
92
|
-
Prefer
|
|
106
|
+
Prefer `chip/<slug>` branch per chip. Records: `~/.greprag/opencode-chips/`. Goals: `~/.greprag/chip-goals/`.
|
|
93
107
|
|
|
94
108
|
## Do not
|
|
95
109
|
|
|
96
|
-
-
|
|
97
|
-
- Dispatch workers from a planner
|
|
110
|
+
- Force path B for a single chip — use path A.
|
|
111
|
+
- Dispatch workers from a **planner** goal (planner accepts LEAD only).
|
|
98
112
|
- Skip IN-FLIGHT or end without DONE/BLOCKED.
|
|
99
|
-
- Use Codex `create_thread` /
|
|
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.
|