greprag 5.79.0 → 5.82.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/capture-manifest.js +2 -1
  2. package/dist/codex-fast-hook.js +6 -0
  3. package/dist/codex-steering.js +1 -1
  4. package/dist/commands/announce.js +97 -0
  5. package/dist/commands/app-model.js +0 -1
  6. package/dist/commands/arm-reminder.js +9 -7
  7. package/dist/commands/collision-check.js +7 -6
  8. package/dist/commands/corpus/client.js +13 -3
  9. package/dist/commands/delivery-reminder.js +35 -14
  10. package/dist/commands/deploy-gate.js +55 -0
  11. package/dist/commands/deploy-lock.js +100 -0
  12. package/dist/commands/deploy-record.js +145 -0
  13. package/dist/commands/deploy-verify.js +111 -0
  14. package/dist/commands/inbox-primer-reminder.js +5 -5
  15. package/dist/commands/inbox-watch.js +2 -4
  16. package/dist/commands/init.js +96 -1
  17. package/dist/commands/load.js +40 -0
  18. package/dist/commands/loadout-reminder.js +1 -1
  19. package/dist/commands/merge-guard.js +419 -0
  20. package/dist/commands/merge-lock.js +176 -0
  21. package/dist/commands/parity-reminder.js +53 -0
  22. package/dist/commands/persona-reminder.js +11 -0
  23. package/dist/commands/persona.js +50 -0
  24. package/dist/commands/procedure.js +77 -6
  25. package/dist/commands/reminder-registry.js +107 -3
  26. package/dist/commands/repodoc.js +433 -0
  27. package/dist/commands/search.js +149 -0
  28. package/dist/commands/skillgain.js +33 -25
  29. package/dist/delivery-lifecycle.js +16 -1
  30. package/dist/deploy-gate.js +355 -0
  31. package/dist/deploy-locks.js +339 -0
  32. package/dist/deploy-verify.js +209 -0
  33. package/dist/env-redaction.js +157 -0
  34. package/dist/harness-limits.js +17 -0
  35. package/dist/hook-runtime.js +11 -1
  36. package/dist/hook.js +229 -88
  37. package/dist/index.js +601 -567
  38. package/dist/inline-atom-episode.js +15 -7
  39. package/dist/inline-atom.js +8 -2
  40. package/dist/native-skill-adoption.js +11 -0
  41. package/dist/native-skill-mirror.js +8 -1
  42. package/dist/node-identity.bundle.js +1166 -0
  43. package/dist/opencode-plugin.bundle.js +307 -119
  44. package/dist/procedure-enabled.js +55 -0
  45. package/dist/procedure-runtime.js +6 -0
  46. package/dist/procedure-scope.js +190 -0
  47. package/dist/procedure-watch.js +29 -16
  48. package/dist/procedure.js +111 -5
  49. package/dist/project-anchor.js +1 -14
  50. package/dist/reminder-injector.js +11 -10
  51. package/dist/repodoc-client.js +296 -0
  52. package/dist/session-id.js +7 -8
  53. package/dist/skill-landing.js +57 -2
  54. package/dist/skill-mirror-client.js +14 -0
  55. package/dist/skill-mirror-files.js +18 -0
  56. package/package.json +2 -2
  57. package/scripts/bundle-node-identity.mjs +47 -0
  58. package/skill/templates/chip-spawn.md +7 -1
  59. package/skill/templates/delivery.md +105 -0
  60. package/skill/templates/prompt-audit.md +196 -0
  61. package/skill/templates/skill-change.md +25 -2
  62. package/dist/assistant-doctrine.js +0 -85
  63. package/dist/commands/assistant-reminder.js +0 -19
  64. package/dist/commands/assistant.js +0 -95
package/dist/index.js CHANGED
@@ -60,14 +60,20 @@ const load_1 = require("./commands/load");
60
60
  const project_1 = require("./commands/project");
61
61
  const procedure_1 = require("./commands/procedure");
62
62
  const delivery_1 = require("./commands/delivery");
63
+ const deploy_gate_1 = require("./commands/deploy-gate");
64
+ const merge_lock_1 = require("./commands/merge-lock");
65
+ const deploy_lock_1 = require("./commands/deploy-lock");
66
+ const deploy_record_1 = require("./commands/deploy-record");
67
+ const deploy_verify_1 = require("./commands/deploy-verify");
63
68
  const skillgain_1 = require("./commands/skillgain");
64
69
  const docptr_1 = require("./commands/docptr");
65
70
  const doc_1 = require("./commands/doc");
66
71
  const parity_1 = require("./commands/parity");
72
+ const repodoc_1 = require("./commands/repodoc");
73
+ const search_1 = require("./commands/search");
67
74
  const agents_1 = require("./commands/agents");
68
75
  const loadout_1 = require("./commands/loadout");
69
76
  const persona_1 = require("./commands/persona");
70
- const assistant_1 = require("./commands/assistant");
71
77
  const email_1 = require("./commands/email");
72
78
  const sms_1 = require("./commands/sms");
73
79
  const codex_1 = require("./commands/codex");
@@ -201,80 +207,78 @@ async function apiDelete(url, apiKey) {
201
207
  throw new Error(`API ${res.status}: ${await res.text()}`);
202
208
  return res.json();
203
209
  }
204
- const INBOX_HELP = `greprag inbox — read + manage your async message inbox.
205
-
206
- greprag inbox List unread for THIS session: its own lines
207
- only (sender or recipient). Other sessions'
208
- private lines AND the front desk are hidden —
209
- the front desk is opt-in (--front-desk).
210
- greprag inbox --front-desk Read the front desk: the tenant catch-all
211
- (cold opens + inbound email). Add --peek to
212
- survey without marking read.
213
- greprag inbox --all Audit peek: drop the per-session scope (every
214
- session's lines) AND include already-read.
215
- greprag inbox --peek List WITHOUT marking read (non-mutating).
216
- greprag inbox --session <8hex> Scope to one specific session's view.
217
- greprag inbox --project <name> Filter to one project's inbox.
218
- greprag inbox watch [...] Long-lived SSE stream (run under Monitor).
219
- [--receptionist] Attend the front desk — wake live on a cold
220
- open / inbound email (else only manual check).
221
- [--assistant] Executive assistant — normal delivery PLUS a
222
- wake on inbound EMAIL arrivals only.
223
- [--mechanic] Live Mechanic — normal delivery PLUS a wake
224
- on tenant mechanic_friction events.
225
- greprag inbox watchers [--json] List live armed GrepRAG/Claude/OpenCode
226
- watchers under your tenant. Codex task
227
- discovery, including repo/workspace, uses
228
- codex_app.list_threads.
229
- greprag inbox reap Kill orphaned watcher processes (consumer gone)
230
- + sweep stale pidfiles. Runs auto at session start.
231
- greprag inbox claim <id> Receptionist: claim a front-desk record so a
232
- co-armed receptionist stands down (no dup reply).
233
- greprag inbox keep <id> Extend a message's TTL.
234
- greprag inbox delete <id> Delete a message.
235
-
236
- To SEND or REPLY (top-level command, NOT an inbox subcommand):
237
- greprag send --to discord:<snowflake> "reply" Reply to a Discord DM.
238
- greprag send "msg" --to <handle>@greprag.com Cold open (tenant catch-all).
239
- greprag send "msg" --to <handle>@greprag.com/<session> Message a specific session.
240
- greprag send "msg" --to <h>@greprag.com/<session> --in-reply-to <front-desk-id>
241
- Reply that threads a cold open.
242
-
243
- Codex session-targeted sends are ordinary durable recipient messages. The
244
- target's Codex turn hooks surface them at SessionStart/UserPromptSubmit
245
- boundaries. Codex-to-Codex coordination uses
210
+ const INBOX_HELP = `greprag inbox — read + manage your async message inbox.
211
+
212
+ greprag inbox List unread for THIS session: its own lines
213
+ only (sender or recipient). Other sessions'
214
+ private lines AND the front desk are hidden —
215
+ the front desk is opt-in (--front-desk).
216
+ greprag inbox --front-desk Read the front desk: the tenant catch-all
217
+ (cold opens + inbound email). Add --peek to
218
+ survey without marking read.
219
+ greprag inbox --all Audit peek: drop the per-session scope (every
220
+ session's lines) AND include already-read.
221
+ greprag inbox --peek List WITHOUT marking read (non-mutating).
222
+ greprag inbox --session <8hex> Scope to one specific session's view.
223
+ greprag inbox --project <name> Filter to one project's inbox.
224
+ greprag inbox watch [...] Long-lived SSE stream (run under Monitor).
225
+ [--receptionist] Attend the front desk — wake live on a cold
226
+ open / inbound email (else only manual check).
227
+ [--mechanic] Live Mechanic — normal delivery PLUS a wake
228
+ on tenant mechanic_friction events.
229
+ greprag inbox watchers [--json] List live armed GrepRAG/Claude/OpenCode
230
+ watchers under your tenant. Codex task
231
+ discovery, including repo/workspace, uses
232
+ codex_app.list_threads.
233
+ greprag inbox reap Kill orphaned watcher processes (consumer gone)
234
+ + sweep stale pidfiles. Runs auto at session start.
235
+ greprag inbox claim <id> Receptionist: claim a front-desk record so a
236
+ co-armed receptionist stands down (no dup reply).
237
+ greprag inbox keep <id> Extend a message's TTL.
238
+ greprag inbox delete <id> Delete a message.
239
+
240
+ To SEND or REPLY (top-level command, NOT an inbox subcommand):
241
+ greprag send --to discord:<snowflake> "reply" Reply to a Discord DM.
242
+ greprag send "msg" --to <handle>@greprag.com Cold open (tenant catch-all).
243
+ greprag send "msg" --to <handle>@greprag.com/<session> Message a specific session.
244
+ greprag send "msg" --to <h>@greprag.com/<session> --in-reply-to <front-desk-id>
245
+ Reply that threads a cold open.
246
+
247
+ Codex session-targeted sends are ordinary durable recipient messages. The
248
+ target's Codex turn hooks surface them at SessionStart/UserPromptSubmit
249
+ boundaries. Codex-to-Codex coordination uses
246
250
  codex_app.send_message_to_thread.`;
247
- const INBOX_WATCH_HELP = `greprag inbox watch — long-lived SSE subscriber for live inbox delivery.
248
-
249
- Run under the Claude Code Monitor tool: each printed line becomes one
250
- notification, so a parent waiting on a chip report gets it the instant it
251
- lands instead of polling.
252
-
253
- greprag inbox watch Tenant-wide stream.
254
- greprag inbox watch --project <name> Only messages addressed to this project.
255
- greprag inbox watch --session <id> Only messages targeting this session.
256
- Strictest — cold opens never wake it
257
- (use --receptionist for the front desk).
258
- greprag inbox watch --since <id|iso> Resume from a known cursor.
259
- greprag inbox watch --json One JSON object per line (preferred under Monitor).
260
- greprag inbox watch --quiet JSON on stdout only. Auto-on when GROK_SESSION_ID is set.
261
- greprag inbox watch --receptionist Attend the front desk — wake live on a
262
- cold open / inbound email.
263
- greprag inbox watch --mechanic Attend as the live Mechanic — wake on
264
- mechanic_friction events.
265
- greprag inbox watch --no-supervise Run the SSE loop directly, skipping the
266
- in-process supervisor (tests/debugging).
267
- greprag inbox watch --owner-pid <n> Owning claude.exe PID (stamped by the arm
268
- directive; the reaper keeps this watcher
269
- iff that PID is a live claude.exe).
270
-
271
- Arm it BARE under Monitor (persistent:true) — no "while true ... sleep 1" wrapper
272
- (removed 2026-06-04; it orphaned and OOM-crashed the host). Resilience by default:
273
- the watch SUPERVISES itself — a parent spawns the SSE loop as a child (Win32
274
- CreateProcess, not Cygwin fork) and respawns it on any non-clean exit (crash,
275
- undici error, OS kill); and it SELF-TERMINATES when its Monitor consumer's pipe
276
- breaks (session reload/end) so it never orphans. Within-session robustness only;
277
- a watcher cannot survive session reload / --resume / /compact.
251
+ const INBOX_WATCH_HELP = `greprag inbox watch — long-lived SSE subscriber for live inbox delivery.
252
+
253
+ Run under the Claude Code Monitor tool: each printed line becomes one
254
+ notification, so a parent waiting on a chip report gets it the instant it
255
+ lands instead of polling.
256
+
257
+ greprag inbox watch Tenant-wide stream.
258
+ greprag inbox watch --project <name> Only messages addressed to this project.
259
+ greprag inbox watch --session <id> Only messages targeting this session.
260
+ Strictest — cold opens never wake it
261
+ (use --receptionist for the front desk).
262
+ greprag inbox watch --since <id|iso> Resume from a known cursor.
263
+ greprag inbox watch --json One JSON object per line (preferred under Monitor).
264
+ greprag inbox watch --quiet JSON on stdout only. Auto-on when GROK_SESSION_ID is set.
265
+ greprag inbox watch --receptionist Attend the front desk — wake live on a
266
+ cold open / inbound email.
267
+ greprag inbox watch --mechanic Attend as the live Mechanic — wake on
268
+ mechanic_friction events.
269
+ greprag inbox watch --no-supervise Run the SSE loop directly, skipping the
270
+ in-process supervisor (tests/debugging).
271
+ greprag inbox watch --owner-pid <n> Owning claude.exe PID (stamped by the arm
272
+ directive; the reaper keeps this watcher
273
+ iff that PID is a live claude.exe).
274
+
275
+ Arm it BARE under Monitor (persistent:true) — no "while true ... sleep 1" wrapper
276
+ (removed 2026-06-04; it orphaned and OOM-crashed the host). Resilience by default:
277
+ the watch SUPERVISES itself — a parent spawns the SSE loop as a child (Win32
278
+ CreateProcess, not Cygwin fork) and respawns it on any non-clean exit (crash,
279
+ undici error, OS kill); and it SELF-TERMINATES when its Monitor consumer's pipe
280
+ breaks (session reload/end) so it never orphans. Within-session robustness only;
281
+ a watcher cannot survive session reload / --resume / /compact.
278
282
  adr: adr/monitor-resilience.md`;
279
283
  function readProjectRegistry() {
280
284
  try {
@@ -299,6 +303,10 @@ function readProjectRegistry() {
299
303
  * desk ensure idempotently spawn a detached desk-line if none is running
300
304
  * desk status is a desk-line up + what local truth would it report now
301
305
  * adr: adr/desk-line-relay.md */
306
+ async function runAnnounce(args) {
307
+ const { runAnnounce: run } = await Promise.resolve().then(() => __importStar(require('./commands/announce')));
308
+ run(args);
309
+ }
302
310
  async function runDesk(args) {
303
311
  ensureEnv(); // load ~/.greprag/.env so GREPRAG_API_KEY is present (self-heals in the detached child)
304
312
  const sub = args[0] || 'status';
@@ -350,6 +358,14 @@ async function inbox(args) {
350
358
  console.log(INBOX_WATCH_HELP);
351
359
  return;
352
360
  }
361
+ // The Assistant role was removed 2026-09-03 (adr/assistant-role.md). Fail
362
+ // loudly rather than silently arming a stock watcher — 5.44.0 already
363
+ // shipped a build where `--assistant` was dropped without error and the
364
+ // operator got a watcher that was not the one they asked for.
365
+ if (subArgs.includes('--assistant')) {
366
+ console.error('Error: --assistant is retired — the GrepRAG Assistant role was removed. Drop the flag for a normal watcher, or use --receptionist for the front desk.');
367
+ process.exit(1);
368
+ }
353
369
  await (0, inbox_watch_1.runInboxWatch)({
354
370
  project: getFlag(subArgs, '--project'),
355
371
  session: getFlag(subArgs, '--session'),
@@ -358,10 +374,6 @@ async function inbox(args) {
358
374
  // --receptionist: attend the front desk — wake live on tenant catch-all
359
375
  // (cold open / inbound email). adr: adr/address-grammar.md
360
376
  receptionist: subArgs.includes('--receptionist'),
361
- // --assistant: attend as the executive assistant — normal session/project
362
- // delivery PLUS a wake on inbound EMAIL arrivals only (not cold opens).
363
- // adr: adr/assistant-role.md
364
- assistant: subArgs.includes('--assistant'),
365
377
  mechanic: subArgs.includes('--mechanic'),
366
378
  // --no-supervise: run the SSE loop directly, skipping the in-process
367
379
  // supervisor. For tests/debugging — the default supervises.
@@ -1260,375 +1272,383 @@ async function retract(args) {
1260
1272
  console.log((0, inbox_retract_1.formatRetractResult)(result.status));
1261
1273
  }
1262
1274
  // -- Main ------------------------------------------------------------------
1263
- const INIT_HELP = `greprag init — configure GrepRAG for an agent client.
1264
-
1265
- greprag init
1266
- greprag init --codex [--api-key <existing-key>]
1267
- greprag init --claude [--api-key <existing-key>]
1268
- greprag init --opencode [--api-key <existing-key>]
1269
- greprag init --grok [--api-key <existing-key>]
1270
- greprag init --all [--root <path>]
1271
- greprag init --global [--name <name>]
1272
-
1273
- Options:
1274
- --api-key <key> Use an existing GrepRAG API key. New accounts are closed.
1275
- --codex Configure Codex hooks + /greprag skill.
1276
- --claude Configure Claude Code hooks + /greprag skill.
1277
- --opencode Configure OpenCode plugin.
1278
- --grok Configure Grok Build hooks + skill + rules.
1279
-
1280
- Codex Desktop trust step:
1281
- After init, start a fresh Codex session, then open Settings -> Settings -> Hooks
1275
+ const INIT_HELP = `greprag init — configure GrepRAG for an agent client.
1276
+
1277
+ greprag init
1278
+ greprag init --codex [--api-key <existing-key>]
1279
+ greprag init --claude [--api-key <existing-key>]
1280
+ greprag init --opencode [--api-key <existing-key>]
1281
+ greprag init --grok [--api-key <existing-key>]
1282
+ greprag init --all [--root <path>]
1283
+ greprag init --global [--name <name>]
1284
+
1285
+ Options:
1286
+ --api-key <key> Use an existing GrepRAG API key. New accounts are closed.
1287
+ --codex Configure Codex hooks + /greprag skill.
1288
+ --claude Configure Claude Code hooks + /greprag skill.
1289
+ --opencode Configure OpenCode plugin.
1290
+ --grok Configure Grok Build hooks + skill + rules.
1291
+
1292
+ Codex Desktop trust step:
1293
+ After init, start a fresh Codex session, then open Settings -> Settings -> Hooks
1282
1294
  and trust the GrepRAG hooks.`;
1283
- const HELP = `
1284
- greprag — agent memory for Claude Code, Codex, OpenCode, and Grok Build
1285
-
1286
- Commands:
1287
- (no command) Open the local GrepRAG app
1288
- app | dashboard [--port N] Open the local app (use --no-open on remote machines)
1289
- init [--api-key <existing-key>]
1290
- Auto-detect/ask for Codex, Claude Code, or OpenCode
1291
- init --claude [--api-key <existing-key>]
1292
- Configure hooks + API key for Claude Code
1293
- init --global [--name <name>] Create ~/.greprag/project.json (global anchor)
1294
- init --opencode [--api-key <existing-key>]
1295
- Configure plugin + anchor for OpenCode
1296
- init --codex [--api-key <existing-key>]
1297
- Configure lifecycle hooks + anchor for Codex
1298
- init --grok [--api-key <existing-key>]
1299
- Configure Grok Build hooks + skill + rules
1300
- grok spawn [--cwd <path>] [--prompt "<text>"]
1301
- Open a fresh Grok TUI in a new terminal
1302
- (Windows schtasks bootloader — survives the
1303
- tool Job Object; child arms its own watch)
1304
- init --all [--root <path>] Standard init for cwd, then bulk-register every
1305
- other git repo at depth 1 under <path> (default:
1306
- parent of repo root). Each becomes inbox-addressable.
1307
- status [--json] [--claude|--codex|--opencode|--grok]
1308
- Installation, auth, platform hooks/plugins, and project state
1309
- codex doctor Diagnose Codex hooks, trust setup, and current thread
1310
- project-id Print the current project_id
1311
- session-id [--full] Print this session's id (8-hex, 16-hex for UUIDv7, or full UUID with --full).
1312
- discover [--json] Tenant-wide structure: every project, per-shape row counts,
1313
- activity ranges. For cross-project advisors.
1314
- doc <command> Mirror, search, and read project Markdown docs.
1315
- docptr <command> Document-pointer registry and reference backfill.
1316
- parity [seed] Doctrine drift-from-canon: the parity table (unit ·
1317
- lead · stale followers), plus the operator-run seed.
1318
- agents <adopt|optimize|sync|status>
1319
- Canonical global/repo CLAUDE.md + AGENTS.md doctrine.
1320
- doctor [--inspect] [--yes] Diagnose + repair orphan project_ids and identity drift
1321
- desk [--json] Inspect the Agent Front Desk and live routing state.
1322
- sms <command> Configure or inspect SMS front-desk routing.
1323
- smell "<text>" Shortcut for \`greprag fix log "<text>"\`.
1324
- context status [--session <id>] Context-size governor readout: live tokens, threshold,
1325
- % consumed, turns since the crossover advisory last fired.
1326
- "context --help" for config (threshold + off-switch).
1327
- delivery <command> Resolve and inspect repo delivery profiles.
1328
- procedure <command> Governed operational procedure watches and runs.
1329
- skillgain <command> Skill-learning queue and installation helpers.
1330
-
1331
- Inbox (email-style messaging across tenants):
1332
- inbox [--all] [--front-desk] [--session <id>] [--project <name>] [--peek]
1333
- List unread, auto-scoped to THIS session: its own
1334
- lines (sender OR recipient) only. Other sessions'
1335
- private lines AND the front desk are hidden by
1336
- default — the front desk (cold opens + inbound
1337
- email) is opt-in via --front-desk.
1338
- --all = audit peek: drop the per-session scope
1339
- (every session's lines) AND include read history.
1340
- --session scopes to one specific session's view.
1341
- --project filters by project name.
1342
- --peek: NON-MUTATING — does not mark any message read.
1343
- inbox watchers [--json] List currently-attached live watchers
1344
- (Claude / Codex / OpenCode / Grok). Each row:
1345
- project · title (session_id) [platform] repo —
1346
- project + nano title from session memory, repo
1347
- from ~/.greprag/projects.json. Codex task
1348
- discovery also uses codex_app.list_threads.
1349
- inbox watch Long-lived SSE stream — prints each message as it lands.
1350
- Self-supervising by default: a parent process
1351
- respawns the SSE loop (via CreateProcess) on any
1352
- non-clean exit — within-session robustness, not
1353
- reload-survival. "inbox watch --help" for details.
1354
- [--project <name>] Filter to one project inbox (default: tenant-wide).
1355
- [--session <id>] Filter to messages targeting this session
1356
- (cold opens never wake it — use --receptionist).
1357
- [--receptionist] Attend the front desk — wake live on a tenant
1358
- catch-all (cold open / inbound email). Without it,
1359
- cold opens surface only on a manual inbox check.
1360
- [--assistant] Executive assistant — keep normal session/project
1361
- delivery AND wake live on inbound EMAIL arrivals
1362
- only (not greprag cold opens). adr/assistant-role.md
1363
- [--mechanic] Live Mechanic — keep normal session/project
1364
- delivery AND wake on tenant mechanic_friction events.
1365
- [--since <id|iso>] Resume after a message id or timestamp.
1366
- [--json] Emit raw JSON per line (for piping to Monitor).
1367
- [--quiet] JSON on stdout only (Grok monitor). Auto-on under GROK_SESSION_ID.
1368
- [--no-supervise] Run the SSE loop directly (no supervisor) — tests/debug.
1369
- inbox claim <id> Receptionist: claim a front-desk record (cold open /
1370
- inbound email). First claimant wins; a co-armed
1371
- receptionist stands down — no double-reply.
1372
- inbox keep <id> Extend a read message's TTL (default delete after 14 days)
1373
- inbox delete <id> Permanently delete a message
1374
- send "body" --to <addr> Send a message. Body is markdown.
1375
- <addr> is a bare handle (tenant catch-all) or
1376
- handle/<target> — see Addresses below.
1377
- send --body-file <path> --to <addr>
1378
- Send a long/multiline body from a file.
1379
- send --stdin --to <addr> Read message body from stdin.
1380
- --from-session <id> Sender's session — denormalized so the recipient can
1381
- reply by session without re-discovery.
1382
- --memory <uuid> (repeatable) back-pointer to a memory row
1383
- --artifact <type:id> (repeatable) e.g. commit:abc123, pr:#42, deploy:def
1384
- --file <path[:lines]> (repeatable) e.g. src/auth.ts, src/auth.ts:42, src/x.ts:10-15
1385
- --ref-json '<json>' escape hatch — full references object
1386
- --in-reply-to <id> Thread a reply back to a front-desk record (cold open /
1387
- inbound email) — sets references.in_reply_to so the
1388
- ensuing private line continues that conversation.
1389
- --to-desk Self-addressed internal mail — posts to THIS project's own
1390
- desk (no recipient; omit --to). Requires --type.
1391
- --type <internal-type> Internal messageType for --to-desk (e.g. lore_smell). Queue
1392
- item drained by its consumer — never wakes a watcher and is
1393
- hidden from the default inbox (audit via 'inbox --all').
1394
- retract <code> Pull back a previously-sent message (code is printed on send).
1395
- discord pair Pair Discord DMs to this project — generates a code to DM the bot.
1396
- discord unpair Remove the Discord pairing.
1397
- discord me Show current Discord pairing + handoff state.
1398
- discord handoff [--ttl N] Pin DMs to this session for N min (default 60); bot DMs a confirmation.
1399
- discord unhandoff Clear the handoff pin (DMs revert to default project).
1400
- discord typing Refresh the "typing…" indicator on the paired DM thread.
1401
- send "body" --to discord:<snowflake>
1402
- Outbound DM to a paired Discord user from any session.
1403
- Unread → hard delete. Read → body replaced with a retracted notice.
1404
- Idempotent: double-retract is a no-op.
1405
-
1406
- Addresses:
1407
- Cold open: <handle>@greprag.com tenant catch-all — first contact when
1408
- you don't know their session. Lands in
1409
- their inbox for a manual check; silent
1410
- (no session wake, no operator ping).
1411
- Session: <handle>@greprag.com/<session-uuid> session-to-session (normal, live)
1412
- Self-desk: --to-desk --type <internal-type> internal queue item on your own project
1413
- desk — no recipient, no wake; drained by
1414
- its typed consumer (e.g. lore_smell).
1415
- --session and --project flags were removed; the address carries the target.
1416
- Project broadcasts (<handle>@greprag.com/<project-name>) were removed.
1417
-
1418
- Email (agent-email front desk — drain inbound attachments to local disk):
1419
- email [pending] List pending front-desk email (envelope only).
1420
- email pull --id <record> Pull ONE record's attachments to local disk.
1421
- email pull --all-pending Pull EVERY pending record's attachments.
1422
- [--to <dir>] Save dir. Default: --to > $GREPRAG_EMAIL_DIR >
1423
- anchor email_dir > ~/.greprag/email/<project>.
1424
- [--quiet] Only print the one-line summary.
1425
- Saved as <subject-slug>-<index>.<ext>; re-pulls
1426
- are idempotent. Auto-save: set email_autosave=true
1427
- in .greprag/project.json so the mail hook pulls
1428
- new attachments each turn.
1429
-
1430
- Memory (episodic project memory — turn/hourly/daily/ship-event):
1431
- memory search "<query>" Lexical retrieval over the project's memory.
1432
- Same v5 RRF + adjacency pipeline as 'corpus
1433
- search'. Use when looking up a specific
1434
- problem, bug, or topic.
1435
- [--limit N=5] [--shape <name>] [--project <name>] [--format markdown|json]
1436
- memory recap Recent daily summaries (SessionStart shape).
1437
- [--daily-last N=7] [--project <name>] [--format markdown|json]
1438
- memory daily [--last N=7] Most-recent daily summaries.
1439
- memory hourly [--last N=24] Most-recent hourly summaries.
1440
- memory turns [--last N=20] Raw per-turn envelopes (21-day TTL).
1441
- memory ships [--last N=50] Ship-event rows (commits/PRs/deploys/releases).
1442
- Common flags: [--project <name>] [--from ISO --to ISO] [--format markdown|json]
1443
- memory compact <hour|day|week> [--now ISO]
1444
- Manual compaction trigger (backfill / admin use).
1445
- memory delete Bulk-delete nodes by filters (combinable). DRY
1446
- RUN by default; pass --yes to execute. ≥1 filter
1447
- required.
1448
- [--project <name>] [--shape <name>] [--from ISO] [--to ISO] [--session <id>] [--yes]
1449
- (Aliases: 'briefing' → 'recap' (renamed v5.16.0); 'odyssey' → 'memory'
1450
- top-level verb (kept for v5.8.0 scripts).)
1451
-
1452
- Project fixes (emergent friction → fix → repair):
1453
- fix spawn --type <harness|doctrine|injection|env|code> "<one unit>"
1454
- [--parent-session <id>]
1455
- THE friction reflex: emit a FIX CHIP mission for
1456
- exactly this typed friction, now; the chip investigates,
1457
- then >=90 repairs autonomously, <90 parks findings.
1458
- fix log "<text>" [--scope <S>] [--repaired] [--project <name>] [--source-session <id>]
1459
- Audit/design-input note only, NOT the friction reflex.
1460
- --repaired records a known durable rule directly
1461
- (requires --scope).
1462
- Top-level alias: greprag smell "<text>".
1463
- fix list [--all] [--repaired] [--project <name>] [--format json]
1464
- Open queue by default; --repaired = resolved durable
1465
- rules grouped by scope; --all = tenant-wide census.
1466
- fix repair <id> "<rule>" [--scope <S>] [--project <name>]
1467
- Resolve a fix: record the durable rule, close the entry.
1468
- fix land <id> --commits <h1,h2> --summary "..." [--files <f,..>] [--units <u,..>] [--harness <h,..>]
1469
- Close a fix with repair-ledger write-back.
1470
- fix ledger [--limit N] [--project <name>] [--format json]
1471
- Fleet-activity digest: what chips repaired, when.
1472
- fix delete <nodeId> [--project <name>]
1473
- Hard-remove a fix (noise / cleanup).
1474
- fix search "<query>" [--scope <S>] [--limit N=10] [--project <name>] [--format markdown|json]
1475
- Lexical search across the project's fixes.
1476
- fix scopes [--project <name>] Distinct scope labels present in this project.
1477
-
1478
- Mechanic control plane (repairs as data — 'greprag mechanic --help'):
1479
- mechanic status [--format json] Inventory of live repairs; ⚑ = ready to graduate.
1480
- mechanic set | unset Mark / unmark THIS project as the live Mechanic role.
1481
- mechanic role [status] Show whether THIS project is the live Mechanic.
1482
- mechanic friction "<summary>" RETIRED: use 'greprag fix spawn --type <type> "<unit>"'.
1483
- mechanic reply --to <8hex> "<msg>" Reply on the typed mechanic rail.
1484
- mechanic attest <nodeId> ... Record operator-attested regression evidence.
1485
- mechanic enable <nodeId> Ratify a shadow repair → active.
1486
- mechanic disable <nodeId> [--retire] active → shadow (default) or terminal retire.
1487
- mechanic why <nodeId> Provenance: friction → fix → repair chain.
1488
- mechanic off | on Panic switch — suspend/resume ALL repairs (local file).
1489
-
1490
- Corpus (upload + search arbitrary text — books, codebases, references):
1491
- corpus upload <file|url> --raw|--enriched Create a store + ingest. Mode REQUIRED:
1492
- [--name <N>] [--kind <K>] --raw (lexical — docs/code) | --enriched (per-node
1493
- [--refresh hourly|daily|manual|off] LLM vocab bridge — prose/voice). K: docs|
1494
- prose|transcript|codebase|voice|generic (default docs). html/pdf/docx/
1495
- xlsx/csv convert server-side. --refresh tracks a URL
1496
- for the freshness loop (URLs only; default off).
1497
- corpus search <store> "<intent>" [--limit 5] [--section "<h>"] [--shape S]
1498
- Single-store search. <store> is a UUID or name.
1499
- corpus search "<intent>" --all|--store <ref>... [--kind K] [--limit 8]
1500
- Multistore search (RRF-fused). --all = every store.
1501
- corpus section <store> "<heading>"
1502
- Every node under a heading (forgiving: any depth,
1503
- dash/case-insensitive).
1504
- corpus walk <store> <nodeId> [--before 2 --after 2]
1505
- Show a node and its surrounding context.
1506
- corpus status <store> Write-side enrichment progress (per-node vocab bridge).
1507
- corpus refresh <store> Manually re-check a tracked source (re-ingest changed blocks).
1508
- corpus sources <store> Freshness state: source, policy, last change, next check.
1509
- corpus list [--kind K] List stores under this tenant.
1510
- corpus delete <store> [--yes] Delete a store and its nodes.
1511
-
1512
- Crush (pre-LLM tool-output compression — safe inside pipes, always exits 0):
1513
- crush --type <log|search|json> [--ccr] [--query "words"]
1514
- Read stdin, write the crushed version to stdout.
1515
- log = build/test output (keep errors/traces/summaries),
1516
- search = grep/rg output (keep scored top matches),
1517
- json = large arrays (keep errors/outliers/first+last).
1518
- --ccr stashes the ORIGINAL locally and appends a
1519
- trailing <<ccr:HASH>> marker. If compression wouldn't
1520
- save tokens (or input is tiny), stdin passes through
1521
- verbatim — never breaks the pipe.
1522
- crush stats Totals + ratios from the pipe-wrap stats log
1523
- (~/.greprag/crush-stats.jsonl — one record per
1524
- --stats invocation; the PreToolUse pipe-wrap
1525
- hook passes --stats on every rewrite).
1526
- retrieve <hash> Print a CCR-stashed original back to stdout.
1527
- Store: ~/.greprag/ccr.db (override GREPRAG_CCR_DB).
1528
- ccr put --type <t> Internal: stash stdin byte-exact in the CCR store,
1529
- print its 16-hex hash (the opencode inline crusher
1530
- uses this to persist originals it crushed in-process).
1531
-
1532
- Archive (governed compact — lossless PNG snapshot of the pre-compact transcript):
1533
- archive render --transcript <path> [--out-dir <dir>] [--session <8hex>]
1534
- Render the transcript main chain to pixel-font
1535
- PNGs (~30K chars/page, pixel round-trip verified)
1536
- and index pages in the CCR store. The PreCompact
1537
- hook runs this automatically before compaction.
1538
- archive list [--session <id>] Indexed archives with page -> turn ranges.
1539
- archive snippet [--session <id>]
1540
- Print the documented /compact instruction block
1541
- (preserve/compress rules + archive pointer line).
1542
-
1543
- Identity (public handle + vanity alias — real email is auth-only, never a routing address):
1544
- identity show | whoami Print numeric handle + claimed aliases.
1545
- identity claim <alias> Claim a vanity alias (e.g. "travis" → travis@greprag.com).
1546
- identity release <alias> Drop a claimed alias.
1547
-
1548
- Skills (opt-in advisor skills bundled with the CLI):
1549
- skill list Show bundled skills and install status
1550
- skill install <name> Install a bundled advisor (e.g. discord, content-advisor)
1551
- skill uninstall <name> Remove a previously-installed advisor
1552
- skill source stamp <name> --project <p> --path <rel> [--path <rel>...] [--baseline <ref>]
1553
- Stamp a skill-staleness baseline against local Git
1554
-
1555
- Load (on-demand doctrine — the CLI is the payload, no .md files):
1556
- load Browse the catalog (chip-spawn, codex chips, mechanic, …)
1557
- load <name> Print that entry's full method inline
1558
-
1559
- Loadout (gift a skill bundle to another tenant — offer, never auto-install):
1560
- loadout send --to <handle>@greprag.com --skill <name> [--skill <n> …]
1561
- [--dir <path>] [--advisor <name>] [--note "…"]
1562
- Freeze + send a loadout. --skill pulls from your
1563
- mirror; --dir snapshots a skill dir from disk.
1564
- loadout list Offered loadouts waiting at your front desk.
1565
- loadout open <id> Manifest + a bounded content preview (never ingests).
1566
- loadout equip <id> Equip it (alias: accept) — copies skills to your load
1567
- store + self-inflates via 'greprag load'.
1568
- loadout decline <id> Decline — GCs the snapshot.
1569
- loadout status Loadouts you've sent (offered/equipped/declined).
1570
- loadout unequip <name> [--delete-skills]
1571
- Stop a loadout's auto-inflate.
1572
-
1573
- Persona (tenant-scoped speaking instructions):
1574
- persona list List built-in Persona templates.
1575
- persona use <template> Activate a built-in Persona template.
1576
- persona set <text>|--file <f>|--stdin
1577
- Save and activate a custom Persona verbatim.
1578
- persona show Show the active Persona.
1579
- persona clear Remove the active Persona.
1580
-
1581
- GrepRAG Instructions (canonical global/repo CLAUDE.md + AGENTS.md):
1582
- instructions pull <file> [--scope global|repo] [--push]
1583
- Pull disk instructions into canon.
1584
- instructions push [--scope global|repo|all] [--check] [--force]
1585
- Render canon back to managed instruction files.
1586
- agents ... Deprecated alias for instructions.
1587
-
1588
- Project metadata (rename / merge / list):
1589
- project rename <new-name> [--yes]
1590
- Rename the project at cwd (anchor + registry + API
1591
- + store metadata). Confirms before writing.
1592
- project merge --from <X> --into <Y> [--apply] [--name <override>] [--json]
1593
- Consolidate one project into another. Defaults to
1594
- dry-run. --from/--into accept a UUID or project_name.
1595
- --name renames the target in the same step.
1596
- project list [--json] Every project under this tenant, with anchor + rows.
1597
-
1598
- Assistant (designate this project as the tenant's GrepRAG Assistant — wakes on
1599
- inbound email, drafts in the operator's voice, sends after Front Desk approval):
1600
- assistant set | unset Mark / unmark THIS project as the Assistant (local
1601
- role flag in .greprag/project.json). When set,
1602
- SessionStart auto-loads the doctrine and the inbox
1603
- watcher arms with --assistant.
1604
- assistant status Show whether THIS project is the Assistant.
1605
-
1606
- Opencode (bridge inbox SSE into a running opencode desktop session — the
1607
- Monitor equivalent, since opencode is turn-based by default):
1608
- opencode relay --session <id> [options]
1609
- Subscribe to /v1/inbox/stream and inject each
1610
- message as a fresh turn in the named opencode
1611
- desktop session via /session/{id}/prompt_async.
1612
- See \`greprag opencode --help\` for flags.
1613
-
1614
- Other:
1615
- expand --chunk <id> Expand a memory cluster (siblings, adjacent, linked)
1616
- help [--all] Show this overview. --all appends every command's
1617
- full --help — the complete, always-current guide.
1618
-
1619
- Examples:
1620
- greprag # open the local customer app
1621
- greprag init # standard repo setup
1622
- greprag init --global # Cowork / unanchored sessions
1623
- greprag init --all # register every sibling repo for inbox
1624
- greprag init --all --root C:\\ # scan a specific directory
1625
- greprag inbox
1626
- greprag send "done with migration" --to alice@greprag.com/abc12345
1627
- # session-targeted (normal)
1628
- greprag send "deploy approved" --to alice@greprag.com
1629
- # cold open — alice's front desk
1630
- greprag send "Bug in auth flow — repro at line 42" --to alice@greprag.com/abc12345 \
1631
- --file src/auth.ts:42 --artifact commit:abc123
1295
+ const HELP = `
1296
+ greprag — agent memory for Claude Code, Codex, OpenCode, and Grok Build
1297
+
1298
+ Commands:
1299
+ (no command) Open the local GrepRAG app
1300
+ app | dashboard [--port N] Open the local app (use --no-open on remote machines)
1301
+ init [--api-key <existing-key>]
1302
+ Auto-detect/ask for Codex, Claude Code, or OpenCode
1303
+ init --claude [--api-key <existing-key>]
1304
+ Configure hooks + API key for Claude Code
1305
+ init --global [--name <name>] Create ~/.greprag/project.json (global anchor)
1306
+ init --opencode [--api-key <existing-key>]
1307
+ Configure plugin + anchor for OpenCode
1308
+ init --codex [--api-key <existing-key>]
1309
+ Configure lifecycle hooks + anchor for Codex
1310
+ init --grok [--api-key <existing-key>]
1311
+ Configure Grok Build hooks + skill + rules
1312
+ grok spawn [--cwd <path>] [--prompt "<text>"]
1313
+ Open a fresh Grok TUI in a new terminal
1314
+ (Windows schtasks bootloader — survives the
1315
+ tool Job Object; child arms its own watch)
1316
+ init --all [--root <path>] Standard init for cwd, then bulk-register every
1317
+ other git repo at depth 1 under <path> (default:
1318
+ parent of repo root). Each becomes inbox-addressable.
1319
+ status [--json] [--claude|--codex|--opencode|--grok]
1320
+ Installation, auth, platform hooks/plugins, and project state
1321
+ codex doctor Diagnose Codex hooks, trust setup, and current thread
1322
+ project-id Print the current project_id
1323
+ session-id [--full] Print this session's id (8-hex, 16-hex for UUIDv7, or full UUID with --full).
1324
+ discover [--json] Tenant-wide structure: every project, per-shape row counts,
1325
+ activity ranges. For cross-project advisors.
1326
+ doc <command> Mirror, search, and read project Markdown docs.
1327
+ docptr <command> Document-pointer registry and reference backfill.
1328
+ parity [seed] Doctrine drift-from-canon: the parity table (unit ·
1329
+ lead · stale followers), plus the operator-run seed.
1330
+ repodoc <index|status> Stable identity for a repo's own Markdown: blocks keep
1331
+ their ids through edits, splits, merges and renames.
1332
+ agents <adopt|optimize|sync|status>
1333
+ Canonical global/repo CLAUDE.md + AGENTS.md doctrine.
1334
+ doctor [--inspect] [--yes] Diagnose + repair orphan project_ids and identity drift
1335
+ desk [--json] Inspect the Agent Front Desk and live routing state.
1336
+ sms <command> Configure or inspect SMS front-desk routing.
1337
+ smell "<text>" Shortcut for \`greprag fix log "<text>"\`.
1338
+ context status [--session <id>] Context-size governor readout: live tokens, threshold,
1339
+ % consumed, turns since the crossover advisory last fired.
1340
+ "context --help" for config (threshold + off-switch).
1341
+ delivery <command> Resolve and inspect repo delivery profiles.
1342
+ deploy-gate [--target <id>] Repo-independent deploy pre-flight: may a deploy run
1343
+ from here, is one already running, what is shipping.
1344
+ Read-only; the artifact proof stays with the repo.
1345
+ merge-lock <acquire|release|status> Serialise merges into a shared canonical
1346
+ checkout. Take it before you merge, release after.
1347
+ deploy-lock <acquire|release|status> --target <id>
1348
+ One deploy at a time per target. Pass --pid so the
1349
+ lock names the deploying process, not this command.
1350
+ deploy-record --target <id> Remember what this checkout last shipped, so the
1351
+ gate can say what a deploy is about to ship.
1352
+ deploy-verify --origin <url> --sha <commit>
1353
+ Prove production is serving the commit you shipped.
1354
+ Refuses if the build stamp is edge-cacheable.
1355
+ procedure <command> Governed operational procedure watches and runs.
1356
+ skillgain <command> Skill-learning queue and installation helpers.
1357
+
1358
+ Inbox (email-style messaging across tenants):
1359
+ inbox [--all] [--front-desk] [--session <id>] [--project <name>] [--peek]
1360
+ List unread, auto-scoped to THIS session: its own
1361
+ lines (sender OR recipient) only. Other sessions'
1362
+ private lines AND the front desk are hidden by
1363
+ default — the front desk (cold opens + inbound
1364
+ email) is opt-in via --front-desk.
1365
+ --all = audit peek: drop the per-session scope
1366
+ (every session's lines) AND include read history.
1367
+ --session scopes to one specific session's view.
1368
+ --project filters by project name.
1369
+ --peek: NON-MUTATING — does not mark any message read.
1370
+ inbox watchers [--json] List currently-attached live watchers
1371
+ (Claude / Codex / OpenCode / Grok). Each row:
1372
+ project · title (session_id) [platform] repo —
1373
+ project + nano title from session memory, repo
1374
+ from ~/.greprag/projects.json. Codex task
1375
+ discovery also uses codex_app.list_threads.
1376
+ inbox watch Long-lived SSE stream — prints each message as it lands.
1377
+ Self-supervising by default: a parent process
1378
+ respawns the SSE loop (via CreateProcess) on any
1379
+ non-clean exit — within-session robustness, not
1380
+ reload-survival. "inbox watch --help" for details.
1381
+ [--project <name>] Filter to one project inbox (default: tenant-wide).
1382
+ [--session <id>] Filter to messages targeting this session
1383
+ (cold opens never wake it — use --receptionist).
1384
+ [--receptionist] Attend the front desk — wake live on a tenant
1385
+ catch-all (cold open / inbound email). Without it,
1386
+ cold opens surface only on a manual inbox check.
1387
+ [--mechanic] Live Mechanic — keep normal session/project
1388
+ delivery AND wake on tenant mechanic_friction events.
1389
+ [--since <id|iso>] Resume after a message id or timestamp.
1390
+ [--json] Emit raw JSON per line (for piping to Monitor).
1391
+ [--quiet] JSON on stdout only (Grok monitor). Auto-on under GROK_SESSION_ID.
1392
+ [--no-supervise] Run the SSE loop directly (no supervisor) — tests/debug.
1393
+ inbox claim <id> Receptionist: claim a front-desk record (cold open /
1394
+ inbound email). First claimant wins; a co-armed
1395
+ receptionist stands down — no double-reply.
1396
+ inbox keep <id> Extend a read message's TTL (default delete after 14 days)
1397
+ inbox delete <id> Permanently delete a message
1398
+ send "body" --to <addr> Send a message. Body is markdown.
1399
+ <addr> is a bare handle (tenant catch-all) or
1400
+ handle/<target> — see Addresses below.
1401
+ send --body-file <path> --to <addr>
1402
+ Send a long/multiline body from a file.
1403
+ send --stdin --to <addr> Read message body from stdin.
1404
+ --from-session <id> Sender's session — denormalized so the recipient can
1405
+ reply by session without re-discovery.
1406
+ --memory <uuid> (repeatable) back-pointer to a memory row
1407
+ --artifact <type:id> (repeatable) e.g. commit:abc123, pr:#42, deploy:def
1408
+ --file <path[:lines]> (repeatable) e.g. src/auth.ts, src/auth.ts:42, src/x.ts:10-15
1409
+ --ref-json '<json>' escape hatch — full references object
1410
+ --in-reply-to <id> Thread a reply back to a front-desk record (cold open /
1411
+ inbound email) — sets references.in_reply_to so the
1412
+ ensuing private line continues that conversation.
1413
+ --to-desk Self-addressed internal mail — posts to THIS project's own
1414
+ desk (no recipient; omit --to). Requires --type.
1415
+ --type <internal-type> Internal messageType for --to-desk (e.g. lore_smell). Queue
1416
+ item drained by its consumer — never wakes a watcher and is
1417
+ hidden from the default inbox (audit via 'inbox --all').
1418
+ retract <code> Pull back a previously-sent message (code is printed on send).
1419
+ discord pair Pair Discord DMs to this project — generates a code to DM the bot.
1420
+ discord unpair Remove the Discord pairing.
1421
+ discord me Show current Discord pairing + handoff state.
1422
+ discord handoff [--ttl N] Pin DMs to this session for N min (default 60); bot DMs a confirmation.
1423
+ discord unhandoff Clear the handoff pin (DMs revert to default project).
1424
+ discord typing Refresh the "typing…" indicator on the paired DM thread.
1425
+ send "body" --to discord:<snowflake>
1426
+ Outbound DM to a paired Discord user from any session.
1427
+ Unread → hard delete. Read → body replaced with a retracted notice.
1428
+ Idempotent: double-retract is a no-op.
1429
+
1430
+ Addresses:
1431
+ Cold open: <handle>@greprag.com tenant catch-all — first contact when
1432
+ you don't know their session. Lands in
1433
+ their inbox for a manual check; silent
1434
+ (no session wake, no operator ping).
1435
+ Session: <handle>@greprag.com/<session-uuid> session-to-session (normal, live)
1436
+ Self-desk: --to-desk --type <internal-type> internal queue item on your own project
1437
+ desk — no recipient, no wake; drained by
1438
+ its typed consumer (e.g. lore_smell).
1439
+ --session and --project flags were removed; the address carries the target.
1440
+ Project broadcasts (<handle>@greprag.com/<project-name>) were removed.
1441
+
1442
+ Email (agent-email front desk — drain inbound attachments to local disk):
1443
+ email [pending] List pending front-desk email (envelope only).
1444
+ email pull --id <record> Pull ONE record's attachments to local disk.
1445
+ email pull --all-pending Pull EVERY pending record's attachments.
1446
+ [--to <dir>] Save dir. Default: --to > $GREPRAG_EMAIL_DIR >
1447
+ anchor email_dir > ~/.greprag/email/<project>.
1448
+ [--quiet] Only print the one-line summary.
1449
+ Saved as <subject-slug>-<index>.<ext>; re-pulls
1450
+ are idempotent. Auto-save: set email_autosave=true
1451
+ in .greprag/project.json so the mail hook pulls
1452
+ new attachments each turn.
1453
+
1454
+ Memory (episodic project memory — turn/hourly/daily/ship-event):
1455
+ memory search "<query>" Lexical retrieval over the project's memory.
1456
+ Same v5 RRF + adjacency pipeline as 'corpus
1457
+ search'. Use when looking up a specific
1458
+ problem, bug, or topic.
1459
+ [--limit N=5] [--shape <name>] [--project <name>] [--format markdown|json]
1460
+ memory recap Recent daily summaries (SessionStart shape).
1461
+ [--daily-last N=7] [--project <name>] [--format markdown|json]
1462
+ memory daily [--last N=7] Most-recent daily summaries.
1463
+ memory hourly [--last N=24] Most-recent hourly summaries.
1464
+ memory turns [--last N=20] Raw per-turn envelopes (21-day TTL).
1465
+ memory ships [--last N=50] Ship-event rows (commits/PRs/deploys/releases).
1466
+ Common flags: [--project <name>] [--from ISO --to ISO] [--format markdown|json]
1467
+ memory compact <hour|day|week> [--now ISO]
1468
+ Manual compaction trigger (backfill / admin use).
1469
+ memory delete Bulk-delete nodes by filters (combinable). DRY
1470
+ RUN by default; pass --yes to execute. ≥1 filter
1471
+ required.
1472
+ [--project <name>] [--shape <name>] [--from ISO] [--to ISO] [--session <id>] [--yes]
1473
+ (Aliases: 'briefing' → 'recap' (renamed v5.16.0); 'odyssey' → 'memory'
1474
+ top-level verb (kept for v5.8.0 scripts).)
1475
+
1476
+ Project fixes (emergent friction → fix → repair):
1477
+ fix spawn --type <harness|doctrine|injection|env|code> "<one unit>"
1478
+ [--parent-session <id>]
1479
+ THE friction reflex: emit a FIX CHIP mission for
1480
+ exactly this typed friction, now; the chip investigates,
1481
+ then >=90 repairs autonomously, <90 parks findings.
1482
+ fix log "<text>" [--scope <S>] [--repaired] [--project <name>] [--source-session <id>]
1483
+ Audit/design-input note only, NOT the friction reflex.
1484
+ --repaired records a known durable rule directly
1485
+ (requires --scope).
1486
+ Top-level alias: greprag smell "<text>".
1487
+ fix list [--all] [--repaired] [--project <name>] [--format json]
1488
+ Open queue by default; --repaired = resolved durable
1489
+ rules grouped by scope; --all = tenant-wide census.
1490
+ fix repair <id> "<rule>" [--scope <S>] [--project <name>]
1491
+ Resolve a fix: record the durable rule, close the entry.
1492
+ fix land <id> --commits <h1,h2> --summary "..." [--files <f,..>] [--units <u,..>] [--harness <h,..>]
1493
+ Close a fix with repair-ledger write-back.
1494
+ fix ledger [--limit N] [--project <name>] [--format json]
1495
+ Fleet-activity digest: what chips repaired, when.
1496
+ fix delete <nodeId> [--project <name>]
1497
+ Hard-remove a fix (noise / cleanup).
1498
+ fix search "<query>" [--scope <S>] [--limit N=10] [--project <name>] [--format markdown|json]
1499
+ Lexical search across the project's fixes.
1500
+ fix scopes [--project <name>] Distinct scope labels present in this project.
1501
+
1502
+ Mechanic control plane (repairs as data — 'greprag mechanic --help'):
1503
+ mechanic status [--format json] Inventory of live repairs; ⚑ = ready to graduate.
1504
+ mechanic set | unset Mark / unmark THIS project as the live Mechanic role.
1505
+ mechanic role [status] Show whether THIS project is the live Mechanic.
1506
+ mechanic friction "<summary>" RETIRED: use 'greprag fix spawn --type <type> "<unit>"'.
1507
+ mechanic reply --to <8hex> "<msg>" Reply on the typed mechanic rail.
1508
+ mechanic attest <nodeId> ... Record operator-attested regression evidence.
1509
+ mechanic enable <nodeId> Ratify a shadow repair → active.
1510
+ mechanic disable <nodeId> [--retire] active → shadow (default) or terminal retire.
1511
+ mechanic why <nodeId> Provenance: friction → fix → repair chain.
1512
+ mechanic off | on Panic switch — suspend/resume ALL repairs (local file).
1513
+
1514
+ Corpus (upload + search arbitrary text — books, codebases, references):
1515
+ corpus upload <file|url> --raw|--enriched Create a store + ingest. Mode REQUIRED:
1516
+ [--name <N>] [--kind <K>] --raw (lexical — docs/code) | --enriched (per-node
1517
+ [--refresh hourly|daily|manual|off] LLM vocab bridge — prose/voice). K: docs|
1518
+ prose|transcript|codebase|voice|generic (default docs). html/pdf/docx/
1519
+ xlsx/csv convert server-side. --refresh tracks a URL
1520
+ for the freshness loop (URLs only; default off).
1521
+ search "<query>" [--limit 8] [--kind K] [--store <ref>] [--section "<h>"] [--json]
1522
+ One search across EVERYTHING greprag holds —
1523
+ reference banks, repo markdown, skills, memory.
1524
+ Start here; the corpus forms below are narrower.
1525
+ corpus search <store> "<intent>" [--limit 5] [--section "<h>"] [--shape S]
1526
+ Single-store search. <store> is a UUID or name.
1527
+ corpus search "<intent>" --all|--store <ref>... [--kind K] [--limit 8]
1528
+ Multistore search (RRF-fused). --all = every store.
1529
+ corpus section <store> "<heading>"
1530
+ Every node under a heading (forgiving: any depth,
1531
+ dash/case-insensitive).
1532
+ corpus walk <store> <nodeId> [--before 2 --after 2]
1533
+ Show a node and its surrounding context.
1534
+ corpus status <store> Write-side enrichment progress (per-node vocab bridge).
1535
+ corpus refresh <store> Manually re-check a tracked source (re-ingest changed blocks).
1536
+ corpus sources <store> Freshness state: source, policy, last change, next check.
1537
+ corpus list [--kind K] List stores under this tenant.
1538
+ corpus delete <store> [--yes] Delete a store and its nodes.
1539
+
1540
+ Crush (pre-LLM tool-output compression — safe inside pipes, always exits 0):
1541
+ crush --type <log|search|json> [--ccr] [--query "words"]
1542
+ Read stdin, write the crushed version to stdout.
1543
+ log = build/test output (keep errors/traces/summaries),
1544
+ search = grep/rg output (keep scored top matches),
1545
+ json = large arrays (keep errors/outliers/first+last).
1546
+ --ccr stashes the ORIGINAL locally and appends a
1547
+ trailing <<ccr:HASH>> marker. If compression wouldn't
1548
+ save tokens (or input is tiny), stdin passes through
1549
+ verbatim — never breaks the pipe.
1550
+ crush stats Totals + ratios from the pipe-wrap stats log
1551
+ (~/.greprag/crush-stats.jsonl — one record per
1552
+ --stats invocation; the PreToolUse pipe-wrap
1553
+ hook passes --stats on every rewrite).
1554
+ retrieve <hash> Print a CCR-stashed original back to stdout.
1555
+ Store: ~/.greprag/ccr.db (override GREPRAG_CCR_DB).
1556
+ ccr put --type <t> Internal: stash stdin byte-exact in the CCR store,
1557
+ print its 16-hex hash (the opencode inline crusher
1558
+ uses this to persist originals it crushed in-process).
1559
+
1560
+ Archive (governed compact — lossless PNG snapshot of the pre-compact transcript):
1561
+ archive render --transcript <path> [--out-dir <dir>] [--session <8hex>]
1562
+ Render the transcript main chain to pixel-font
1563
+ PNGs (~30K chars/page, pixel round-trip verified)
1564
+ and index pages in the CCR store. The PreCompact
1565
+ hook runs this automatically before compaction.
1566
+ archive list [--session <id>] Indexed archives with page -> turn ranges.
1567
+ archive snippet [--session <id>]
1568
+ Print the documented /compact instruction block
1569
+ (preserve/compress rules + archive pointer line).
1570
+
1571
+ Identity (public handle + vanity alias — real email is auth-only, never a routing address):
1572
+ identity show | whoami Print numeric handle + claimed aliases.
1573
+ identity claim <alias> Claim a vanity alias (e.g. "travis" → travis@greprag.com).
1574
+ identity release <alias> Drop a claimed alias.
1575
+
1576
+ Skills (opt-in advisor skills bundled with the CLI):
1577
+ skill list Show bundled skills and install status
1578
+ skill install <name> Install a bundled advisor (e.g. discord, content-advisor)
1579
+ skill uninstall <name> Remove a previously-installed advisor
1580
+ skill source stamp <name> --project <p> --path <rel> [--path <rel>...] [--baseline <ref>]
1581
+ Stamp a skill-staleness baseline against local Git
1582
+
1583
+ Load (on-demand doctrine — the CLI is the payload, no .md files):
1584
+ load Browse the catalog (chip-spawn, codex chips, mechanic, …)
1585
+ load <name> Print that entry's full method inline
1586
+
1587
+ Loadout (gift a skill bundle to another tenant — offer, never auto-install):
1588
+ loadout send --to <handle>@greprag.com --skill <name> [--skill <n> …]
1589
+ [--dir <path>] [--advisor <name>] [--note "…"]
1590
+ Freeze + send a loadout. --skill pulls from your
1591
+ mirror; --dir snapshots a skill dir from disk.
1592
+ loadout list Offered loadouts waiting at your front desk.
1593
+ loadout open <id> Manifest + a bounded content preview (never ingests).
1594
+ loadout equip <id> Equip it (alias: accept) — copies skills to your load
1595
+ store + self-inflates via 'greprag load'.
1596
+ loadout decline <id> Decline — GCs the snapshot.
1597
+ loadout status Loadouts you've sent (offered/equipped/declined).
1598
+ loadout unequip <name> [--delete-skills]
1599
+ Stop a loadout's auto-inflate.
1600
+
1601
+ Persona (tenant-scoped speaking instructions):
1602
+ persona list List built-in Persona templates.
1603
+ persona use <template> Activate a built-in Persona template.
1604
+ persona set <text>|--file <f>|--stdin
1605
+ Save and activate a custom Persona verbatim.
1606
+ persona show Show the active Persona.
1607
+ persona clear Remove the active Persona.
1608
+
1609
+ GrepRAG Instructions (canonical global/repo CLAUDE.md + AGENTS.md):
1610
+ instructions pull <file> [--scope global|repo] [--push]
1611
+ Pull disk instructions into canon.
1612
+ instructions push [--scope global|repo|all] [--check] [--force]
1613
+ Render canon back to managed instruction files.
1614
+ agents ... Deprecated alias for instructions.
1615
+
1616
+ Project metadata (rename / merge / list):
1617
+ project rename <new-name> [--yes]
1618
+ Rename the project at cwd (anchor + registry + API
1619
+ + store metadata). Confirms before writing.
1620
+ project merge --from <X> --into <Y> [--apply] [--name <override>] [--json]
1621
+ Consolidate one project into another. Defaults to
1622
+ dry-run. --from/--into accept a UUID or project_name.
1623
+ --name renames the target in the same step.
1624
+ project list [--json] Every project under this tenant, with anchor + rows.
1625
+
1626
+ Opencode (bridge inbox SSE into a running opencode desktop session — the
1627
+ Monitor equivalent, since opencode is turn-based by default):
1628
+ opencode relay --session <id> [options]
1629
+ Subscribe to /v1/inbox/stream and inject each
1630
+ message as a fresh turn in the named opencode
1631
+ desktop session via /session/{id}/prompt_async.
1632
+ See \`greprag opencode --help\` for flags.
1633
+
1634
+ Other:
1635
+ expand --chunk <id> Expand a memory cluster (siblings, adjacent, linked)
1636
+ help [--all] Show this overview. --all appends every command's
1637
+ full --help — the complete, always-current guide.
1638
+
1639
+ Examples:
1640
+ greprag # open the local customer app
1641
+ greprag init # standard repo setup
1642
+ greprag init --global # Cowork / unanchored sessions
1643
+ greprag init --all # register every sibling repo for inbox
1644
+ greprag init --all --root C:\\ # scan a specific directory
1645
+ greprag inbox
1646
+ greprag send "done with migration" --to alice@greprag.com/abc12345
1647
+ # session-targeted (normal)
1648
+ greprag send "deploy approved" --to alice@greprag.com
1649
+ # cold open — alice's front desk
1650
+ greprag send "Bug in auth flow — repro at line 42" --to alice@greprag.com/abc12345 \
1651
+ --file src/auth.ts:42 --artifact commit:abc123
1632
1652
  `.trim();
1633
1653
  /** Groups that ship their own detailed `--help`. `help --all` invokes each one
1634
1654
  * live and captures its output, so the assembled guide is rendered from the
@@ -1648,7 +1668,11 @@ const HELP_ALL_GROUPS = [
1648
1668
  ['identity', identity_1.runIdentity],
1649
1669
  ['project', project_1.runProject],
1650
1670
  ['delivery', delivery_1.runDelivery],
1651
- ['assistant', assistant_1.runAssistant],
1671
+ ['deploy-gate', deploy_gate_1.runDeployGate],
1672
+ ['merge-lock', merge_lock_1.runMergeLock],
1673
+ ['deploy-lock', deploy_lock_1.runDeployLock],
1674
+ ['deploy-record', deploy_record_1.runDeployRecord],
1675
+ ['deploy-verify', deploy_verify_1.runDeployVerify],
1652
1676
  ['instructions', agents_1.runInstructions],
1653
1677
  ['persona', persona_1.runPersona],
1654
1678
  ['doc', doc_1.runDoc],
@@ -1657,125 +1681,125 @@ const HELP_ALL_GROUPS = [
1657
1681
  ['crush', crush_1.runCrush],
1658
1682
  ['archive', archive_1.runArchive],
1659
1683
  ];
1660
- const OPENCODE_HELP = `greprag opencode — bridge greprag inbox into a running opencode desktop
1661
- session, plus a file-watching capture pipeline for episodic memory.
1662
-
1663
- Two subcommands:
1664
-
1665
- greprag opencode relay Bridge greprag inbox into a running opencode
1666
- desktop session. Single POST to
1667
- /session/{id}/prompt_async enqueues a fresh turn;
1668
- the desktop app renders it into the conversation
1669
- feed via the same SSE channel the engine uses.
1670
- Desktop-only by design — the TUI control plane
1671
- is deprecated.
1672
-
1673
- Session-to-session by default: the relay derives
1674
- the greprag 8-hex from the opencode session UUID
1675
- and filters the inbox stream to only messages
1676
- addressed to THIS session. Use --tenant-wide to
1677
- opt into the noisy debug mode (every message in
1678
- the tenant, including messages for other
1679
- sessions).
1680
-
1681
- greprag opencode chip Spawn OpenCode Desktop chips (session.create + prompt_async).
1682
- greprag opencode watch Long-lived SQLite poller on opencode's local DB.
1683
- Captures every (user, assistant) turn pair to
1684
- greprag memory. Bypasses opencode's event bus
1685
- entirely — reads the same rows the engine writes
1686
- the moment a turn completes.
1687
-
1688
- opencode is turn-based: it has no built-in "Monitor" tool like Claude Code.
1689
- \`relay\` is the bridge for live inbox delivery. \`watch\` is the capture
1690
- pipeline. Run both, in separate processes, as long-lived siblings.
1691
-
1692
- opencode relay — bridge greprag inbox into a running opencode desktop
1693
- session.
1694
-
1695
- This command subscribes to /v1/inbox/stream (same SSE channel inbox watch
1696
- uses) and POSTs every inbound message to /session/{id}/prompt_async on
1697
- the running opencode server. The receiving desktop session renders the
1698
- injected prompt as a fresh turn in its conversation feed.
1699
-
1700
- Usage:
1701
- greprag opencode relay --session <opencode-session-id> [options]
1702
-
1703
- Required:
1704
- --session <id> opencode session id (UUID). Find via
1705
- \`opencode session list\` or the session header in
1706
- the opencode UI.
1707
-
1708
- Options:
1709
- --opencode-url <u> opencode server base URL.
1710
- Default http://127.0.0.1:4096.
1711
- Env override: OPENCODE_URL.
1712
- --project <name> Filter the inbox stream to one project.
1713
- --inbox-session <8hex> Filter to one greprag session (8-hex id). Default
1714
- is auto-derived from --session (truncateSessionId)
1715
- so the relay only sees messages addressed to THIS
1716
- opencode session. Pass explicitly to override
1717
- (e.g. share one greprag session across multiple
1718
- opencode sessions).
1719
- --tenant-wide See every message in the tenant's inbox stream,
1720
- including messages addressed to other sessions.
1721
- Debug flag — noisy, usually wrong.
1722
- --since <id-or-iso> Resume cursor.
1723
- --print Pretty-print each message to stdout.
1724
- --dry-run Resolve + format, do not POST.
1725
-
1726
- Resilience mirrors inbox-watch: exponential backoff, idle timeout,
1727
- cursor-preserving reconnect. Production wraps this in a \`while true\` shell
1728
- loop so process death auto-restarts:
1729
-
1730
- while true; do greprag opencode relay --session <id>; \\
1731
- echo "[restart]" >&2; sleep 1; done
1732
-
1733
- Senders reach THIS session by addressing
1734
- \`<handle>@greprag.com/<8hex>\` where <8hex> is the first 8 hex chars of the
1735
- opencode session id (or pass \`--from-session <8hex>\` so the recipient can
1736
- reply back by session without re-discovering it).
1737
-
1738
-
1739
- opencode watch — SQLite-polling turn capture for episodic memory.
1740
-
1741
- opencode persists every message + part as a row in
1742
- %USERPROFILE%\\.local\\share\\opencode\\opencode.db (SQLite, WAL mode)
1743
- the moment the AI finishes streaming. This command polls that DB every
1744
- 1-2s, joins \`message\` to \`session\` to recover the working directory,
1745
- walks up to the greprag anchor, and POSTs the (user, assistant) pair to
1746
- /v1/memory/turn. No event bus. No sidecar auth. No plugin loader.
1747
-
1748
- Why this exists: opencode Desktop's event bus does not reliably emit
1749
- \`message.updated\` for the user's active session, so a plugin hook is
1750
- unreliable for capture. The on-disk DB is the source of truth — it is
1751
- written by the engine itself the moment a turn completes.
1752
-
1753
- Usage:
1754
- greprag opencode watch [options]
1755
-
1756
- Options:
1757
- --interval <ms> Poll interval. Default 1500.
1758
- --db <path> Override DB path. Default
1759
- %USERPROFILE%\\.local\\share\\opencode\\opencode.db
1760
- --project <dir> Only capture turns whose session.directory
1761
- resolves to this directory (anchor walk-up
1762
- target). Useful when running this once per
1763
- worktree.
1764
- --since <ms> Resume from this epoch ms. Default reads the
1765
- cursor (~/.greprag/opencode-watch.cursor).
1766
- On first run, captures every historical turn.
1767
- --cursor <file> Override the cursor file path.
1768
- --reset-cursor Delete the cursor file before starting. Use
1769
- with --since <ms> to re-capture from a point.
1770
- --json Print one JSON object per captured turn to
1771
- stdout, instead of human-readable status to
1772
- stderr.
1773
- --dry-run Print the would-be POST body, do not send.
1774
-
1775
- Run under a long-lived shell loop or as a Windows service:
1776
-
1777
- while true; do greprag opencode watch; \\
1778
- echo "[restart]" >&2; sleep 1; done
1684
+ const OPENCODE_HELP = `greprag opencode — bridge greprag inbox into a running opencode desktop
1685
+ session, plus a file-watching capture pipeline for episodic memory.
1686
+
1687
+ Two subcommands:
1688
+
1689
+ greprag opencode relay Bridge greprag inbox into a running opencode
1690
+ desktop session. Single POST to
1691
+ /session/{id}/prompt_async enqueues a fresh turn;
1692
+ the desktop app renders it into the conversation
1693
+ feed via the same SSE channel the engine uses.
1694
+ Desktop-only by design — the TUI control plane
1695
+ is deprecated.
1696
+
1697
+ Session-to-session by default: the relay derives
1698
+ the greprag 8-hex from the opencode session UUID
1699
+ and filters the inbox stream to only messages
1700
+ addressed to THIS session. Use --tenant-wide to
1701
+ opt into the noisy debug mode (every message in
1702
+ the tenant, including messages for other
1703
+ sessions).
1704
+
1705
+ greprag opencode chip Spawn OpenCode Desktop chips (session.create + prompt_async).
1706
+ greprag opencode watch Long-lived SQLite poller on opencode's local DB.
1707
+ Captures every (user, assistant) turn pair to
1708
+ greprag memory. Bypasses opencode's event bus
1709
+ entirely — reads the same rows the engine writes
1710
+ the moment a turn completes.
1711
+
1712
+ opencode is turn-based: it has no built-in "Monitor" tool like Claude Code.
1713
+ \`relay\` is the bridge for live inbox delivery. \`watch\` is the capture
1714
+ pipeline. Run both, in separate processes, as long-lived siblings.
1715
+
1716
+ opencode relay — bridge greprag inbox into a running opencode desktop
1717
+ session.
1718
+
1719
+ This command subscribes to /v1/inbox/stream (same SSE channel inbox watch
1720
+ uses) and POSTs every inbound message to /session/{id}/prompt_async on
1721
+ the running opencode server. The receiving desktop session renders the
1722
+ injected prompt as a fresh turn in its conversation feed.
1723
+
1724
+ Usage:
1725
+ greprag opencode relay --session <opencode-session-id> [options]
1726
+
1727
+ Required:
1728
+ --session <id> opencode session id (UUID). Find via
1729
+ \`opencode session list\` or the session header in
1730
+ the opencode UI.
1731
+
1732
+ Options:
1733
+ --opencode-url <u> opencode server base URL.
1734
+ Default http://127.0.0.1:4096.
1735
+ Env override: OPENCODE_URL.
1736
+ --project <name> Filter the inbox stream to one project.
1737
+ --inbox-session <8hex> Filter to one greprag session (8-hex id). Default
1738
+ is auto-derived from --session (truncateSessionId)
1739
+ so the relay only sees messages addressed to THIS
1740
+ opencode session. Pass explicitly to override
1741
+ (e.g. share one greprag session across multiple
1742
+ opencode sessions).
1743
+ --tenant-wide See every message in the tenant's inbox stream,
1744
+ including messages addressed to other sessions.
1745
+ Debug flag — noisy, usually wrong.
1746
+ --since <id-or-iso> Resume cursor.
1747
+ --print Pretty-print each message to stdout.
1748
+ --dry-run Resolve + format, do not POST.
1749
+
1750
+ Resilience mirrors inbox-watch: exponential backoff, idle timeout,
1751
+ cursor-preserving reconnect. Production wraps this in a \`while true\` shell
1752
+ loop so process death auto-restarts:
1753
+
1754
+ while true; do greprag opencode relay --session <id>; \\
1755
+ echo "[restart]" >&2; sleep 1; done
1756
+
1757
+ Senders reach THIS session by addressing
1758
+ \`<handle>@greprag.com/<8hex>\` where <8hex> is the first 8 hex chars of the
1759
+ opencode session id (or pass \`--from-session <8hex>\` so the recipient can
1760
+ reply back by session without re-discovering it).
1761
+
1762
+
1763
+ opencode watch — SQLite-polling turn capture for episodic memory.
1764
+
1765
+ opencode persists every message + part as a row in
1766
+ %USERPROFILE%\\.local\\share\\opencode\\opencode.db (SQLite, WAL mode)
1767
+ the moment the AI finishes streaming. This command polls that DB every
1768
+ 1-2s, joins \`message\` to \`session\` to recover the working directory,
1769
+ walks up to the greprag anchor, and POSTs the (user, assistant) pair to
1770
+ /v1/memory/turn. No event bus. No sidecar auth. No plugin loader.
1771
+
1772
+ Why this exists: opencode Desktop's event bus does not reliably emit
1773
+ \`message.updated\` for the user's active session, so a plugin hook is
1774
+ unreliable for capture. The on-disk DB is the source of truth — it is
1775
+ written by the engine itself the moment a turn completes.
1776
+
1777
+ Usage:
1778
+ greprag opencode watch [options]
1779
+
1780
+ Options:
1781
+ --interval <ms> Poll interval. Default 1500.
1782
+ --db <path> Override DB path. Default
1783
+ %USERPROFILE%\\.local\\share\\opencode\\opencode.db
1784
+ --project <dir> Only capture turns whose session.directory
1785
+ resolves to this directory (anchor walk-up
1786
+ target). Useful when running this once per
1787
+ worktree.
1788
+ --since <ms> Resume from this epoch ms. Default reads the
1789
+ cursor (~/.greprag/opencode-watch.cursor).
1790
+ On first run, captures every historical turn.
1791
+ --cursor <file> Override the cursor file path.
1792
+ --reset-cursor Delete the cursor file before starting. Use
1793
+ with --since <ms> to re-capture from a point.
1794
+ --json Print one JSON object per captured turn to
1795
+ stdout, instead of human-readable status to
1796
+ stderr.
1797
+ --dry-run Print the would-be POST body, do not send.
1798
+
1799
+ Run under a long-lived shell loop or as a Windows service:
1800
+
1801
+ while true; do greprag opencode watch; \\
1802
+ echo "[restart]" >&2; sleep 1; done
1779
1803
  `;
1780
1804
  /** greprag opencode <subcommand> — TUI bridge + capture watcher. */
1781
1805
  async function opencode(args) {
@@ -1906,6 +1930,10 @@ async function main() {
1906
1930
  return;
1907
1931
  }
1908
1932
  case 'inbox': return inbox(subArgs);
1933
+ // The full SessionStart announce. The harness inlines only ~2KB of it, so the
1934
+ // overflow is parked here and the inline pointer names this command.
1935
+ // adr: adr/announce-inline-budget.md
1936
+ case 'announce': return runAnnounce(subArgs);
1909
1937
  case 'desk': return runDesk(subArgs);
1910
1938
  case 'email': return (0, email_1.runEmail)(subArgs);
1911
1939
  case 'send': return send(subArgs);
@@ -1914,6 +1942,7 @@ async function main() {
1914
1942
  case 'sms': return (0, sms_1.runSms)(subArgs);
1915
1943
  case 'codex': return (0, codex_1.runCodex)(subArgs);
1916
1944
  case 'expand': return expand(subArgs);
1945
+ case 'search': return (0, search_1.runSearch)(subArgs); // one lexical search across everything (adr/searchable-store-kinds.md)
1917
1946
  case 'corpus': return (0, corpus_1.runCorpus)(subArgs);
1918
1947
  case 'session': return (0, session_1.runSession)(subArgs);
1919
1948
  case 'discover': return (0, discover_1.runDiscover)(subArgs);
@@ -1937,16 +1966,21 @@ async function main() {
1937
1966
  case 'load': return (0, load_1.runLoad)(subArgs); // Interrupt System doctrine loader: bare = catalog, <name> = full entry
1938
1967
  case 'project': return (0, project_1.runProject)(subArgs);
1939
1968
  case 'delivery': return (0, delivery_1.runDelivery)(subArgs); // transitional repo delivery profile resolver
1969
+ case 'deploy-gate': return (0, deploy_gate_1.runDeployGate)(subArgs); // portable deploy pre-flight (adr/deploy-gate-cli.md)
1970
+ case 'merge-lock': return (0, merge_lock_1.runMergeLock)(subArgs); // serialise merges into a shared checkout
1971
+ case 'deploy-lock': return (0, deploy_lock_1.runDeployLock)(subArgs); // one deploy at a time per target (adr/deploy-gate-cli.md)
1972
+ case 'deploy-record': return (0, deploy_record_1.runDeployRecord)(subArgs); // remember what this checkout last shipped
1973
+ case 'deploy-verify': return (0, deploy_verify_1.runDeployVerify)(subArgs); // did production take the upload? (adr/deploy-gate-cli.md)
1940
1974
  case 'procedure': return (0, procedure_1.runProcedure)(subArgs); // Procedure System: operational recipes (docs/procedure-system.md)
1941
1975
  case 'skillgain': return (0, skillgain_1.runSkillGain)(subArgs); // Skill Learning Loop: gain queue verbs (docs/skill-learning-loop.md)
1942
1976
  case 'doc': return (0, doc_1.runDoc)(subArgs); // Project Markdown mirror: sync/search/read exact docs through GrepRAG
1943
1977
  case 'docptr': return (0, docptr_1.runDocPtr)(subArgs); // Document Pointer System: backfill the doc registry (docs/doc-pointer-system.md)
1944
1978
  case 'parity': return (0, parity_1.runParity)(subArgs); // Parity System: doctrine drift table + manifest seed (docs/parity-system.md)
1979
+ case 'repodoc': return (0, repodoc_1.runRepoDoc)(subArgs); // Repo markdown identity that survives edits (docs/node-identity-port.md)
1945
1980
  case 'instructions': return (0, agents_1.runInstructions)(subArgs); // Canonical GrepRAG Instructions + rendered followers
1946
1981
  case 'agents': return (0, agents_1.runAgents)(subArgs); // Deprecated alias for GrepRAG Instructions
1947
1982
  case 'loadout': return (0, loadout_1.runLoadout)(subArgs); // Loadout: cross-tenant skill-bundle gifting (docs/loadout.md)
1948
1983
  case 'persona': return (0, persona_1.runPersona)(subArgs); // tenant-scoped speaking instructions
1949
- case 'assistant': return (0, assistant_1.runAssistant)(subArgs); // designate this project as the tenant's Assistant (role flag)
1950
1984
  case 'opencode': return opencode(subArgs);
1951
1985
  case 'grok': return (0, grok_spawn_1.runGrok)(subArgs);
1952
1986
  default: