greprag 5.56.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 (70) 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/loadout.js +34 -2
  56. package/dist/commands/loadout.js.map +1 -1
  57. package/dist/commands/reminder-registry.js +1 -0
  58. package/dist/commands/reminder-registry.js.map +1 -1
  59. package/dist/commands/reminder-types.d.ts +12 -0
  60. package/dist/commands/version-reminder.d.ts +13 -1
  61. package/dist/commands/version-reminder.js +24 -1
  62. package/dist/commands/version-reminder.js.map +1 -1
  63. package/dist/hook.js +33 -5
  64. package/dist/hook.js.map +1 -1
  65. package/dist/opencode-plugin.bundle.js +23 -1
  66. package/package.json +1 -1
  67. package/skill/greprag/SKILL.md +8 -4
  68. package/skill/greprag/docs/codex-chip.md +38 -0
  69. package/skill/greprag/docs/setup.md +3 -2
  70. package/skill/templates/codex-chip-spawn.md +139 -0
@@ -13,10 +13,11 @@ description: |
13
13
  memory", "memory recap", "memory search", "Odyssey briefing", "catch me
14
14
  up", "what did we do last week", "what's been happening in this
15
15
  project", "find that bug we hit", "search memory for X", "session
16
- context".
16
+ context", "Codex chip", "chip spawn", "spawn a Codex task", "parallel
17
+ Codex work", "isolated Codex session", or "repo collisions".
17
18
  metadata:
18
19
  author: travsteward
19
- version: "3.9.0"
20
+ version: "3.10.0"
20
21
  repository: https://github.com/travsteward/greprag
21
22
  license: MIT
22
23
  ---
@@ -30,6 +31,8 @@ Platform setup is progressive:
30
31
  - **Claude Code**: see `docs/setup.md § claude-code` for the default hook/Monitor/conventions path (`greprag init --claude` or detected `greprag init`).
31
32
  - **OpenCode**: see `docs/setup.md § opencode` for plugin install (`greprag init --opencode`).
32
33
 
34
+ For collision-safe parallel Codex implementation, read `docs/codex-chip.md`.
35
+
33
36
  ## Step 1 — Status
34
37
 
35
38
  ```bash
@@ -50,7 +53,7 @@ For Codex, also inspect:
50
53
  node -e "const fs=require('fs'),os=require('os'),p=require('path');const hp=p.join(os.homedir(),'.codex','hooks.json');const envp=p.join(os.homedir(),'.greprag','.env');let h={};try{h=JSON.parse(fs.readFileSync(hp,'utf8'))}catch{};const has=(evt,cmd)=>((h.hooks&&h.hooks[evt])||[]).some(e=>(e.hooks||[]).some(x=>(x.command||'').includes(cmd)));console.log(fs.existsSync(envp)?'CODEX_ENV_OK':'CODEX_ENV_MISSING');console.log(has('UserPromptSubmit','codex-notify')?'CODEX_NOTIFY_OK':'CODEX_NOTIFY_MISSING');console.log(has('PostToolUse','codex-inbox')?'CODEX_INBOX_OK':'CODEX_INBOX_MISSING');console.log(has('Stop','codex-store')?'CODEX_STORE_OK':'CODEX_STORE_MISSING');console.log(has('SessionStart','recap')?'CODEX_RECAP_OK':'CODEX_RECAP_MISSING');"
51
54
  ```
52
55
 
53
- If any Codex check is missing, route to `docs/setup.md § codex`. If hooks exist but memory is not being captured, remind the user to open Codex Desktop Settings -> Settings -> Hooks, trust the 6 GrepRAG commands, and start a fresh session.
56
+ If any Codex check is missing, route to `docs/setup.md § codex`. If hooks exist but memory is not being captured, remind the user to open Codex Desktop Settings -> Settings -> Hooks, trust the GrepRAG commands, and start a fresh session.
54
57
 
55
58
  Chip-spawn convention marker (in `~/.claude/CLAUDE.md`):
56
59
  ```bash
@@ -125,7 +128,7 @@ Aliases (silent back-compat): `greprag memory briefing` → `recap` (renamed v5.
125
128
 
126
129
  **COLLISION IN A REPO? (another live session working the SAME repo) — MESSAGE IT, DON'T CLOBBER IT.** `greprag inbox watchers --json` lists every live session under your tenant (`project_id · session_id(8hex) · title`); a collision = a row with YOUR project and a different `session_id`. When you spot one, (1) `greprag send "…what you're touching…" --to <handle>@greprag.com/<their-8hex> --from-session <your-8hex>` a contextual heads-up, and (2) do code work in a worktree on its own branch, merging to main only on the operator's word. The `greprag-hook collision-check` SessionStart reflex injects this directive automatically once wired — but the discipline is yours regardless. Full mechanism + wiring: `docs/collision-schematic.md`.
127
130
 
128
- **Codex: DO NOT CLAIM HOOKS ARE ACTIVE JUST BECAUSE `~/.codex/hooks.json` EXISTS.** Codex Desktop requires Settings -> Settings -> Hooks trust review before command hooks run automatically. If turn capture is missing after `greprag init --codex`, tell the user: open Codex Desktop Settings -> Settings -> Hooks, trust the 6 GrepRAG hooks, then start a fresh Codex session.
131
+ **Codex: DO NOT CLAIM HOOKS ARE ACTIVE JUST BECAUSE `~/.codex/hooks.json` EXISTS.** Codex Desktop requires Settings -> Settings -> Hooks trust review before command hooks run automatically. If turn capture is missing after `greprag init --codex`, tell the user: open Codex Desktop Settings -> Settings -> Hooks, trust the GrepRAG hooks, then start a fresh Codex session.
129
132
 
130
133
  **Codex live inbox push requires the startup watcher plus target-thread delivery.** Hooks only fire at Codex turn/tool/session boundaries. Public installs should use `greprag init --codex --tenant-id <handle> --install-watcher`; run `greprag codex doctor --wake-test` to inspect state, and use `greprag codex watch --session <id>` only for foreground testing. The sidecar listens to GrepRAG inbox SSE. Native `send_message_to_thread` / `codex_delegation` proved the messaging pattern; on Windows the public sidecar uses Codex app-server stdio `thread/resume` for the exact target thread, then `turn/start` or `turn/steer`, and keeps the bridge alive until the turn settles. `codex exec resume` is diagnostic/history-only because it can append to history without surfacing in the active Desktop pane. If wake-test reports no app-server-resume path, describe live push as unavailable/non-visible and rely on turn-bound inbox steering for reliable delivery.
131
134
 
@@ -137,6 +140,7 @@ Aliases (silent back-compat): `greprag memory briefing` → `recap` (renamed v5.
137
140
 
138
141
  - `docs/setup.md` — codex · claude-code · opencode · auth · hooks · conventions · permissions · channels · anchor · bulk-register
139
142
  - `docs/platforms.md` — exact platform paths for Claude Code · Codex · OpenCode
143
+ - `docs/codex-chip.md` — first-class Codex task spawn, leases, reporting, steering, cleanup
140
144
  - `docs/per-project-flags.md` — flip `memory_capture` / `session_start_recap` / `inbox_notify`
141
145
  - `docs/inbox.md` — `greprag send`, `greprag inbox`, address grammar, retract (internal messaging)
142
146
  - `docs/email.md` — `greprag email send`/`pending`/`pull`/`boxes`/`domain` — REAL SMTP: send-as custom domains, segregated mailboxes (distinct from `send`)
@@ -0,0 +1,38 @@
1
+ # Codex chips
2
+
3
+ Use a chip when parallel work needs an independent Codex task and repository
4
+ isolation. A chip is a new app-server thread, not a native subagent.
5
+
6
+ ```bash
7
+ greprag codex chip spawn "<task>" --name <slug> --owns "src/area/**"
8
+ ```
9
+
10
+ The standard/default profile is `gpt-5.6-luna` at `xhigh`. Use
11
+ `--profile complex` (or `--complex`) for `gpt-5.6-sol` at `high` when the chip
12
+ owns orchestration or unusually difficult work. Explicit `--model <model-id>`
13
+ and `--effort none|minimal|low|medium|high|xhigh|max|ultra` create a custom
14
+ override.
15
+
16
+ Declare every path the child may change. Split overlapping work differently;
17
+ never bypass a lease collision. Use `--read-only` for research or review.
18
+
19
+ Inspect and control with:
20
+
21
+ ```bash
22
+ greprag codex chip list
23
+ greprag codex chip status <id|name>
24
+ greprag codex chip steer <id|name> "<correction>"
25
+ greprag codex chip stop <id|name>
26
+ ```
27
+
28
+ The child commits inside its isolated checkout and runs `greprag codex chip report`.
29
+ The host validates the receipt and imports only that unique branch. The parent reviews
30
+ the reported commit and integrates it. Never ask the child to merge, push, or
31
+ delete its own checkout. After integration, the parent runs:
32
+
33
+ ```bash
34
+ greprag codex chip cleanup <id|name>
35
+ ```
36
+
37
+ Messages between the parent and child use the normal GrepRAG session inbox, so
38
+ the same communication path also works across Claude, Codex, and OpenCode.
@@ -21,6 +21,7 @@ This writes `~/.greprag/.env` plus `~/.codex/hooks.json`. The Codex hooks are:
21
21
  - `PostToolUse` → `greprag-hook codex-inbox`
22
22
  - `Stop` → `greprag-hook codex-store`
23
23
  - `PostCompact` → `greprag-hook session-id`
24
+ - chip lifecycle events → `greprag-hook codex-chip-hook`
24
25
 
25
26
  It also installs the bundled `/greprag` skill at
26
27
  `~/.codex/skills/greprag` and refreshes the shared identity cache at
@@ -35,7 +36,7 @@ greprag codex startup install
35
36
 
36
37
  After install, Codex still requires trust review. Tell the user:
37
38
 
38
- > Open Codex Desktop Settings -> Settings -> Hooks, trust the 6 GrepRAG hooks,
39
+ > Open Codex Desktop Settings -> Settings -> Hooks, trust the GrepRAG hooks,
39
40
  > then start a fresh Codex session.
40
41
 
41
42
  Do not try to approve hooks on the user's behalf. This is Codex Desktop's trust
@@ -53,7 +54,7 @@ node -e "const fs=require('fs'),os=require('os'),p=require('path');const hp=p.jo
53
54
  If hook entries are missing, re-run `greprag init --codex`. If entries exist
54
55
  but turns are not saving, the most likely cause is untrusted hooks or an old
55
56
  session that started before trust. Tell the user to open Codex Desktop Settings
56
- -> Settings -> Hooks, trust the 6 GrepRAG commands, and restart Codex.
57
+ -> Settings -> Hooks, trust the GrepRAG commands, and restart Codex.
57
58
 
58
59
  Codex live inbox delivery requires the sidecar. Public installs should use the
59
60
  startup helper above. For foreground/manual testing:
@@ -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.