greprag 5.57.0 → 5.58.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 (64) 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 +38 -0
  63. package/skill/greprag/docs/setup.md +3 -2
  64. package/skill/templates/codex-chip-spawn.md +139 -0
@@ -0,0 +1,139 @@
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: `. Every spawned worker title
13
+ begins `Chip: `; the native handoff supplies the exact title.
14
+
15
+ ## Prepare the isolated task
16
+
17
+ Every write chip declares non-overlapping ownership leases; research uses
18
+ `--read-only`. The parent session id is mandatory.
19
+
20
+ ```bash
21
+ greprag codex chip spawn "<independent task>" \
22
+ --name <slug> \
23
+ --owns "<path/**>" \
24
+ --codex-project-id <desktop-project-id> \
25
+ --parent-session <parent-thread-id> \
26
+ --json
27
+ ```
28
+
29
+ The parent/`LEAD:` selects each worker model before dispatch; the child never
30
+ self-selects or changes it. Defaults are exact:
31
+
32
+ - **Standard — `gpt-5.6-luna` / `xhigh`:** bounded single-owner execution with
33
+ clear acceptance criteria: scoped implementation, tests, docs, or focused
34
+ research/review.
35
+ - **Complex — `gpt-5.6-sol` / `high`:** use when *any* hard signal applies:
36
+ orchestration/decomposition; multi-chip integration or merge arbitration;
37
+ architecture/API/schema decisions; cross-cutting ownership; ambiguous
38
+ requirements needing synthesis; high-risk migration/security/accounting
39
+ correctness; or novel diagnosis with multiple interacting hypotheses.
40
+
41
+ In multi-chip missions the `LEAD:` itself is Sol/high, but it classifies every
42
+ worker independently—workers do not inherit Sol. Complex selection requires a
43
+ concise `--model-reason` plus one or more `--complexity-signal` values:
44
+ `orchestration`, `multi-chip-integration`, `architecture-api-schema`,
45
+ `cross-cutting-ownership`, `ambiguous-synthesis`, `high-risk-correctness`, or
46
+ `novel-multi-hypothesis-diagnosis`. Explicit `--model`/`--effort` overrides are
47
+ supported and require `--model-reason`; standard records its rubric reason by
48
+ default. Native Desktop `thinking` uses the callable enum and is checked against
49
+ the selected model's advertised effort matrix.
50
+ An arbitrary custom native model also requires `--native-model-verified`, which
51
+ means the parent verified it on the Desktop surface before dispatch. The
52
+ manifest persists profile/model/effort, parent session in
53
+ `selectedBy`, reason, and matched signals.
54
+
55
+ Native Desktop is the default runtime.
56
+ `--runtime cli` is opt-in and only valid when PATH Codex `model/list` actually
57
+ exposes the requested model and effort; validation remains fail-loud.
58
+
59
+ The spawn command creates a unique starting branch, records the manifest and
60
+ lease, and returns a `greprag-codex-native-v3` handoff. Pass `createRequest`
61
+ exactly to native `create_thread`: `target.type=project`, the supplied Codex
62
+ `projectId` from `list_projects`, and `environment.type=worktree` with
63
+ `startingState={type:"branch", branchName}`.
64
+ `expectedBaseSha` is the attach-time commit invariant behind that reserved branch.
65
+ Do not add `cwd`, `title`, `model`, or `effort`—they are not valid create fields.
66
+
67
+ Creation returns `clientThreadId` while Codex builds its own detached worktree.
68
+ Wait for the bootstrap/auto-title turn to settle and verify the nonce-bearing
69
+ `bootstrapAck`. Resolve `threadId` + actual cwd with `list_threads`/`read_thread`.
70
+ Then call `set_thread_title` with the exact `Chip: ` name (`LEAD: ` for an
71
+ orchestrator) and read it back twice. Retry the rename at most three times if
72
+ auto-title overwrites it; fail loudly if it will not remain exact. Only then run
73
+ `verifyTitleCommand`, rerun handoff, and run `attachCommand`. Attach validates
74
+ project/base/sandbox attestation, writes the marker, sends parent `IN-FLIGHT`,
75
+ and starts the monitor. Rerun handoff again and deliver `sendRequest` via
76
+ `send_message_to_thread`. The enforced order is create → settle → rename →
77
+ verify → attach → IN-FLIGHT → mission. This two-phase send applies
78
+ `model` + `thinking` after creation because high/xhigh validation rejects a
79
+ worktree `startingState` create request. A standalone CLI cannot
80
+ invoke the Desktop-owned surface, so it prepares rather than pretending an old
81
+ PATH app-server successfully ran a 5.6 turn.
82
+
83
+ ## Mandatory parent inbox lifecycle
84
+
85
+ The child must address the recorded parent session, not a bare mailbox:
86
+
87
+ - `IN-FLIGHT` immediately after it starts work.
88
+ - `DONE` before ending, with commit + checks, by running the exact `codex chip
89
+ report` command in its opening prompt.
90
+ - `BLOCKED` before ending when it cannot finish, by running the exact `codex
91
+ chip block` command.
92
+ - If the work crosses the selected model boundary, send a breakthrough message
93
+ explaining the new signal. The parent decides whether to steer or relaunch;
94
+ the child never swaps models autonomously.
95
+
96
+ The attached host monitor validates receipts from the recorded native cwd,
97
+ exact base ancestry, clean state, and every changed path against the lease. A
98
+ detached HEAD is valid; the host imports the reported exact commit into the
99
+ reserved chip ref, then sends the terminal inbox event. The
100
+ child never merges, pushes, cleans up, or edits the parent checkout. The parent
101
+ reviews/integrates and runs `greprag codex chip cleanup <id>` only afterward.
102
+ After a verified squash/cherry-pick (where the exact report commit is not an
103
+ ancestor), the parent acknowledges integration with `cleanup <id> --integrated`;
104
+ ordinary merge ancestry remains automatic.
105
+
106
+ Native chips have a receipt deadline (default 180 minutes; override with
107
+ `--native-timeout-minutes`). This standalone CLI cannot query Desktop-private
108
+ turn status, so it never guesses that a settled task succeeded: write *and read*
109
+ chips must submit `report`/`block`, and timeout fails loudly. One live monitor
110
+ per chip is enforced. `reconcile` expires unattached setup after 10 minutes,
111
+ retires stale blocked chips after 24 hours, and surfaces terminal-delivery
112
+ failure. Lifecycle inbox sends validate HTTP status, target session, sender
113
+ session, and durable event receipts; a duplicate monitor cannot double-send.
114
+ If initial `IN-FLIGHT` delivery fails, attach remains verified and retryable
115
+ instead of terminally stranding the task. Server-side idempotency serializes
116
+ the claim and preserves the originally resolved target across retries.
117
+
118
+ The native worktree sandbox is the physical boundary. Verification accepts only
119
+ the Codex-issued `client-new-thread:<uuid>` token (or its bare UUID form), a
120
+ distinct resolved UUID task ID, the expected project/base/bootstrap proof,
121
+ an attested `workspace-write` sandbox, and a Git root beneath Codex's own
122
+ `worktrees` directory at the exact base commit. Hook guards require the exact
123
+ bound task/cwd/sandbox and deny out-of-lease file tools, destructive
124
+ Git/cleanup, and symlink/junction creation; link-based escape is never allowed.
125
+ Generated verify/attach/report commands pin resolved stable Node and CLI paths,
126
+ so restarting Codex does not invalidate an in-flight chip contract.
127
+
128
+ Useful recovery commands:
129
+
130
+ ```bash
131
+ greprag codex chip handoff <id> --json
132
+ greprag codex chip status <id>
133
+ greprag codex chip steer <id> "<follow-up>"
134
+ greprag codex chip stop <id>
135
+ ```
136
+
137
+ For a native chip, `steer` emits a `send_message_to_thread` handoff. Stop fails
138
+ loud until the parent interrupts the Desktop task, then confirms that fact with
139
+ `stop <id> --native-interrupted`; the CLI never records a false cancellation.