greprag 5.74.21 → 5.76.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.
@@ -0,0 +1,101 @@
1
+ # Grok Chip Spawn Method
2
+
3
+ The Grok chip is a **real TUI**: `greprag grok spawn` opens a `cmd /k` bootloader
4
+ outside the tool Job Object. The child is its own Grok session (`$GROK_SESSION_ID`),
5
+ arms its own quiet inbox watch, and talks on `greprag send`. Proven 2026-08-21
6
+ (parent ping → child pong on the mesh).
7
+
8
+ `spawn_subagent` is **not** a chip. It is a same-pager helper: no window, no
9
+ inbox watch, dies with the parent. Use it for a bounded look-up. Never for a
10
+ unit of work that must survive this session or that the operator should sit in.
11
+
12
+ > **Part of a multi-chip mission?** If this chip is one of ≥2 aimed at a single
13
+ > objective, stop and run `greprag load chip-leader` first. A lone chip at its
14
+ > own objective proceeds here.
15
+
16
+ There is no `pre-spawn-check` on Grok. You write Block 1 + task + Block 2 into
17
+ the prompt yourself.
18
+
19
+ ## What the parent provides
20
+
21
+ - `title: "Chip: <verb-phrase>"` — or leader label `"Chip A: …"` / `"Chip B: …"`.
22
+ - Isolated worktree, then spawn `--cwd` **into that worktree**.
23
+ - Prompt file: Block 1 + task body + Block 2.
24
+ - Parent already has **one** quiet watch. Do not arm a second.
25
+
26
+ `<slug>` = title slugified (`Chip: Fix synthesis loop` → `fix-synthesis-loop`).
27
+ `<parent-uuid>` = **this** session's `$GROK_SESSION_ID` (full UUID). Short form
28
+ for display is **16 hex**, never 8 (UUIDv7 8-hex collides ~65s).
29
+ `<handle>` = operator greprag handle (from `greprag whoami`).
30
+
31
+ ## Parent — worktree then spawn (PowerShell)
32
+
33
+ ```powershell
34
+ $repo = (git rev-parse --show-toplevel)
35
+ $slug = "<slug>"
36
+ $wt = Join-Path $repo ".claude\worktrees\$slug"
37
+ if (-not (Test-Path $wt)) {
38
+ git worktree add $wt -b "chip/$slug"
39
+ }
40
+ $promptFile = Join-Path $env:TEMP "greprag-chip-$slug.md"
41
+ Set-Content -LiteralPath $promptFile -Value $prompt -Encoding utf8
42
+ greprag grok spawn --cwd $wt --title "Chip: <verb-phrase>" --prompt-file $promptFile
43
+ ```
44
+
45
+ `$prompt` is Block 1 + task + Block 2 below. After spawn, wait for `IN-FLIGHT`
46
+ on **your** watch. No ping = the window did not boot — do not wait on results.
47
+
48
+ ## Block 1 — Setup (verbatim, substitute parent uuid + handle)
49
+
50
+ The chip starts already in the worktree (`--cwd`). It substitutes
51
+ `<own-session-id>` from `$GROK_SESSION_ID`.
52
+
53
+ ````
54
+ **Setup — do this FIRST:**
55
+
56
+ 1. Session id is `$GROK_SESSION_ID` (full UUID). Short = first 16 hex, dashes stripped.
57
+ 2. Arm ONE quiet watch (skip if a greprag inbox monitor is already listed):
58
+
59
+ ```
60
+ greprag inbox watch --session $GROK_SESSION_ID --json --quiet
61
+ ```
62
+
63
+ Grok `monitor`, `persistent:true`. Not Claude Monitor. Instant exit = already armed.
64
+
65
+ 3. Ping the parent:
66
+
67
+ ```
68
+ greprag send "IN-FLIGHT: chip/<slug> launched — working" --to <handle>@greprag.com/<parent-uuid> --from-session $GROK_SESSION_ID
69
+ ```
70
+
71
+ 4. If `scripts/worktree-bootstrap.cjs` exists, run `node scripts/worktree-bootstrap.cjs`.
72
+ ````
73
+
74
+ ## Task body
75
+
76
+ The work. Isolated to this worktree / `chip/<slug>`. Default autonomous. To pause
77
+ for a human, say so in the body and `BLOCKED` ping the parent.
78
+
79
+ ## Block 2 — Report back (verbatim)
80
+
81
+ ````
82
+ **Block 2 — Report back via greprag inbox:**
83
+
84
+ ```
85
+ greprag send "<status>: <commit hash> on chip/<slug> — <one-line>" --to <handle>@greprag.com/<parent-uuid> --from-session $GROK_SESSION_ID --artifact commit:<hash>
86
+ ```
87
+
88
+ Cleanup HARD RULE: no `git clean`, `git reset --hard`, `git worktree remove`,
89
+ `git checkout <other>`, raw `rm -rf` outside this worktree's tracked files.
90
+ ````
91
+
92
+ ## After spawning (parent)
93
+
94
+ Keep **one** watch. Talk with `greprag send --to <handle>@greprag.com/<child-full-uuid> --from-session $GROK_SESSION_ID`.
95
+ `greprag inbox watchers` lists the child once it has armed. Child watch events
96
+ may print on this TUI — they belong to the child; do not steal its turn.
97
+
98
+ Merge / prune: same HARD RULES as `greprag load chip-spawn` (junction guard,
99
+ `git worktree remove .claude/worktrees/<slug>`, `git branch -d chip/<slug>`).
100
+ FIX chips: `greprag fix spawn` still prints the mission; you launch it with
101
+ this method instead of `spawn_task`.