greprag 5.57.0 → 5.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/codex-chip-hooks.d.ts +20 -0
  2. package/dist/codex-chip-hooks.js +217 -0
  3. package/dist/codex-chip-hooks.js.map +1 -0
  4. package/dist/commands/codex-chip/command.d.ts +3 -0
  5. package/dist/commands/codex-chip/command.js +583 -0
  6. package/dist/commands/codex-chip/command.js.map +1 -0
  7. package/dist/commands/codex-chip/git.d.ts +30 -0
  8. package/dist/commands/codex-chip/git.js +223 -0
  9. package/dist/commands/codex-chip/git.js.map +1 -0
  10. package/dist/commands/codex-chip/inbox.d.ts +10 -0
  11. package/dist/commands/codex-chip/inbox.js +128 -0
  12. package/dist/commands/codex-chip/inbox.js.map +1 -0
  13. package/dist/commands/codex-chip/lifecycle.d.ts +5 -0
  14. package/dist/commands/codex-chip/lifecycle.js +94 -0
  15. package/dist/commands/codex-chip/lifecycle.js.map +1 -0
  16. package/dist/commands/codex-chip/model.d.ts +92 -0
  17. package/dist/commands/codex-chip/model.js +16 -0
  18. package/dist/commands/codex-chip/model.js.map +1 -0
  19. package/dist/commands/codex-chip/native.d.ts +62 -0
  20. package/dist/commands/codex-chip/native.js +283 -0
  21. package/dist/commands/codex-chip/native.js.map +1 -0
  22. package/dist/commands/codex-chip/prompt.d.ts +2 -0
  23. package/dist/commands/codex-chip/prompt.js +44 -0
  24. package/dist/commands/codex-chip/prompt.js.map +1 -0
  25. package/dist/commands/codex-chip/selection.d.ts +14 -0
  26. package/dist/commands/codex-chip/selection.js +109 -0
  27. package/dist/commands/codex-chip/selection.js.map +1 -0
  28. package/dist/commands/codex-chip/store.d.ts +15 -0
  29. package/dist/commands/codex-chip/store.js +197 -0
  30. package/dist/commands/codex-chip/store.js.map +1 -0
  31. package/dist/commands/codex-chip/worker.d.ts +4 -0
  32. package/dist/commands/codex-chip/worker.js +344 -0
  33. package/dist/commands/codex-chip/worker.js.map +1 -0
  34. package/dist/commands/codex-doctor.js +8 -1
  35. package/dist/commands/codex-doctor.js.map +1 -1
  36. package/dist/commands/codex-startup.d.ts +13 -0
  37. package/dist/commands/codex-startup.js +177 -0
  38. package/dist/commands/codex-startup.js.map +1 -0
  39. package/dist/commands/codex-supervisor.d.ts +5 -0
  40. package/dist/commands/codex-supervisor.js +59 -10
  41. package/dist/commands/codex-supervisor.js.map +1 -1
  42. package/dist/commands/codex-watch-health.d.ts +57 -0
  43. package/dist/commands/codex-watch-health.js +168 -0
  44. package/dist/commands/codex-watch-health.js.map +1 -0
  45. package/dist/commands/codex.d.ts +1 -11
  46. package/dist/commands/codex.js +104 -144
  47. package/dist/commands/codex.js.map +1 -1
  48. package/dist/commands/init.js +23 -0
  49. package/dist/commands/init.js.map +1 -1
  50. package/dist/commands/load-primer-reminder.d.ts +4 -0
  51. package/dist/commands/load-primer-reminder.js +15 -2
  52. package/dist/commands/load-primer-reminder.js.map +1 -1
  53. package/dist/commands/load.js +4 -0
  54. package/dist/commands/load.js.map +1 -1
  55. package/dist/commands/reminder-registry.js +1 -0
  56. package/dist/commands/reminder-registry.js.map +1 -1
  57. package/dist/hook.js +8 -1
  58. package/dist/hook.js.map +1 -1
  59. package/dist/opencode-plugin.bundle.js +13 -1
  60. package/package.json +1 -1
  61. package/skill/greprag/SKILL.md +8 -4
  62. package/skill/greprag/docs/codex-chip.md +50 -0
  63. package/skill/greprag/docs/setup.md +3 -2
  64. package/skill/templates/chip-leader.md +25 -0
  65. package/skill/templates/codex-chip-spawn.md +158 -0
@@ -0,0 +1,158 @@
1
+ # Codex Chip Spawn
2
+
3
+ This is the Codex Desktop chip method. It is separate from Claude Code
4
+ `spawn_task`: never use or copy the Claude Block 1/Block 2 prompt here.
5
+
6
+ ## Gate: one chip or a mission?
7
+
8
+ A single independent task proceeds directly. If two or more chips target one
9
+ objective, or you are about to create a second chip, stop and run `greprag load
10
+ chip-leader`. Plan the integration branch, ownership seams, dependency order,
11
+ merge order, and whole-feature test gate before another spawn. Rename the
12
+ orchestrating task so its title begins `LEAD: <Mission>`. Multi-chip workers are
13
+ uniquely named `Chip A: <Specific Purview>`, `Chip B: ...`; a single worker is
14
+ `Chip: <Purview>`. Labels are stable coordination handles, not execution order.
15
+
16
+ ## Prepare the isolated task
17
+
18
+ Every mission starts with a durable parent-owned goal. Give it a concrete
19
+ objective, final state, and stable acceptance criterion IDs. Every write chip
20
+ declares non-overlapping ownership leases; research uses `--read-only`.
21
+
22
+ ```bash
23
+ greprag codex chip goal create \
24
+ --objective "<concrete objective>" \
25
+ --final-state "<observable final state>" \
26
+ --criterion <id>:"<acceptance statement>"
27
+
28
+ greprag codex chip spawn "<independent task>" \
29
+ --name <slug> \
30
+ --title "<Properly Capitalized Purview>" \
31
+ --goal-id <goal-id> --covers <criterion-id> \
32
+ --owns "<path/**>" \
33
+ --codex-project-id <desktop-project-id> \
34
+ --parent-session <parent-thread-id> \
35
+ --json
36
+ ```
37
+
38
+ The parent/`LEAD:` selects each worker model before dispatch; the child never
39
+ self-selects or changes it. Defaults are exact:
40
+
41
+ - **Standard — `gpt-5.6-luna` / `xhigh`:** bounded single-owner execution with
42
+ clear acceptance criteria: scoped implementation, tests, docs, or focused
43
+ research/review.
44
+ - **Complex — `gpt-5.6-sol` / `high`:** use when *any* hard signal applies:
45
+ orchestration/decomposition; multi-chip integration or merge arbitration;
46
+ architecture/API/schema decisions; cross-cutting ownership; ambiguous
47
+ requirements needing synthesis; high-risk migration/security/accounting
48
+ correctness; or novel diagnosis with multiple interacting hypotheses.
49
+
50
+ In multi-chip missions the `LEAD:` itself is Sol/high, but it classifies every
51
+ worker independently—workers do not inherit Sol. Complex selection requires a
52
+ concise `--model-reason` plus one or more `--complexity-signal` values:
53
+ `orchestration`, `multi-chip-integration`, `architecture-api-schema`,
54
+ `cross-cutting-ownership`, `ambiguous-synthesis`, `high-risk-correctness`, or
55
+ `novel-multi-hypothesis-diagnosis`. Explicit `--model`/`--effort` overrides are
56
+ supported and require `--model-reason`; standard records its rubric reason by
57
+ default. Native Desktop `thinking` uses the callable enum and is checked against
58
+ the selected model's advertised effort matrix.
59
+ An arbitrary custom native model also requires `--native-model-verified`, which
60
+ means the parent verified it on the Desktop surface before dispatch. The
61
+ manifest persists profile/model/effort, parent session in
62
+ `selectedBy`, reason, and matched signals.
63
+
64
+ Native Desktop is the default runtime.
65
+ `--runtime cli` is opt-in and only valid when PATH Codex `model/list` actually
66
+ exposes the requested model and effort; validation remains fail-loud.
67
+
68
+ For a multi-chip mission every spawn also uses `--multi-chip --label A` (then B,
69
+ C...) and a different `--title`. Duplicate active slugs, labels, or purview
70
+ titles fail loudly.
71
+
72
+ The spawn command creates a unique starting branch, records the manifest and
73
+ lease, and returns a `greprag-codex-native-v4` handoff. Pass `createRequest`
74
+ exactly to native `create_thread`: it already contains the full real mission,
75
+ selected `model`, `thinking`, project target, and worktree starting branch.
76
+ `expectedBaseSha` is the attach-time commit invariant behind that reserved branch.
77
+ This is the only assignment turn. Never create a bootstrap task and never send
78
+ the mission again after attach.
79
+
80
+ Creation returns `clientThreadId` while Codex builds its own detached worktree.
81
+ The initial `UserPromptSubmit` hook provisionally binds the manifest and native
82
+ cwd before tool use. Resolve `threadId` + actual cwd immediately, then call
83
+ `set_thread_title` with the exact handoff title and read it back twice. Retry at
84
+ most three times if auto-title overwrites it; fail loudly if it will not remain
85
+ exact. `create_thread` has no title field, so the mission's first line carries
86
+ the correct identity immediately and task metadata is renamed as soon as the
87
+ resolved task exists. Only then run
88
+ `verifyTitleCommand`, rerun handoff, and run `attachCommand`. Attach validates
89
+ project/base/sandbox attestation, writes the marker, sends parent `IN-FLIGHT`,
90
+ and starts the monitor. The enforced order is create-real-mission → provisional
91
+ bind → resolve → rename/verify → attach → IN-FLIGHT → monitor. A standalone CLI cannot
92
+ invoke the Desktop-owned surface, so it prepares rather than pretending an old
93
+ PATH app-server successfully ran a 5.6 turn.
94
+
95
+ ## Mandatory parent inbox lifecycle
96
+
97
+ The child must address the recorded parent session, not a bare mailbox:
98
+
99
+ - `IN-FLIGHT` immediately after it starts work.
100
+ - `DONE` before ending, with commit + checks, by running the exact `codex chip
101
+ report` command in its opening prompt.
102
+ - `BLOCKED` before ending when it cannot finish, by running the exact `codex
103
+ chip block` command.
104
+ - If the work crosses the selected model boundary, send a breakthrough message
105
+ explaining the new signal. The parent decides whether to steer or relaunch;
106
+ the child never swaps models autonomously.
107
+
108
+ The attached host monitor validates receipts from the recorded native cwd,
109
+ exact base ancestry, clean state, and every changed path against the lease. A
110
+ detached HEAD is valid; the host imports the reported exact commit into the
111
+ reserved chip ref, then sends the terminal inbox event. The
112
+ child never merges, pushes, cleans up, or edits the parent checkout. Reports map
113
+ concrete evidence to every covered goal criterion. The parent reviews the diff,
114
+ integrates it, and runs `greprag codex chip goal accept <goal-id> --summary
115
+ "<review judgment>"` only when all criteria and chips are satisfied. For a
116
+ verified squash/cherry-pick add `--integrated <chip-id>` to acceptance. Acceptance
117
+ returns machine-readable closeout entries: apply each native `archiveRequest`
118
+ first, then its exact `cleanupCommand`. Cleanup does not imply acceptance, is
119
+ refused before it, and requires `--native-archived` for native tasks.
120
+
121
+ Native chips have a receipt deadline (default 180 minutes; override with
122
+ `--native-timeout-minutes`). This standalone CLI cannot query Desktop-private
123
+ turn status, so it never guesses that a settled task succeeded: write *and read*
124
+ chips must submit `report`/`block`, and timeout fails loudly. One live monitor
125
+ per chip is enforced. `reconcile` expires unattached setup after 10 minutes,
126
+ retires stale blocked chips after 24 hours, and surfaces terminal-delivery
127
+ failure. Lifecycle inbox sends validate HTTP status, target session, sender
128
+ session, and durable event receipts; a duplicate monitor cannot double-send.
129
+ If initial `IN-FLIGHT` delivery fails, attach remains verified and retryable
130
+ instead of terminally stranding the task. Server-side idempotency serializes
131
+ the claim and preserves the originally resolved target across retries.
132
+
133
+ The native worktree sandbox is the physical boundary. Verification accepts only
134
+ the Codex-issued `client-new-thread:<uuid>` token (or its bare UUID form), a
135
+ distinct resolved UUID task ID, the expected project/base proof,
136
+ an attested `workspace-write` sandbox, and a Git root beneath Codex's own
137
+ `worktrees` directory at the exact base commit. Hook guards require the exact
138
+ bound task/cwd/sandbox and deny out-of-lease file tools, destructive
139
+ Git/cleanup, and symlink/junction creation; link-based escape is never allowed.
140
+ Generated verify/attach/report commands pin resolved stable Node and CLI paths,
141
+ so restarting Codex does not invalidate an in-flight chip contract.
142
+
143
+ Useful recovery commands:
144
+
145
+ ```bash
146
+ greprag codex chip handoff <id> --json
147
+ greprag codex chip status <id>
148
+ greprag codex chip steer <id> "<follow-up>"
149
+ greprag codex chip resume <id>
150
+ greprag codex chip stop <id>
151
+ ```
152
+
153
+ For a native chip, `steer` emits a `send_message_to_thread` handoff. Stop fails
154
+ loud until the parent interrupts the Desktop task, then confirms that fact with
155
+ `stop <id> --native-interrupted`; the CLI never records a false cancellation.
156
+ After restart/usage interruption, use `resume`, deliver its handoff, and wait for
157
+ the nonce-bound breakthrough acknowledgment. A delivered message without that
158
+ ack is not recovery. Cleaned/cancelled/failed tasks cannot resume; relaunch them.