harnex 0.12.0 → 0.29.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +592 -0
- data/GUIDE.md +222 -68
- data/README.md +78 -48
- data/TECHNICAL.md +235 -98
- data/agents/gpt.md +60 -0
- data/docs/agents.md +119 -0
- data/docs/dispatch-telemetry.md +184 -50
- data/docs/events.md +20 -7
- data/docs/lanes.md +202 -0
- data/docs/mcp.md +102 -0
- data/docs/pi-rpc.md +81 -7
- data/docs/upgrading-to-0.29.md +87 -0
- data/guides/01_dispatch.md +101 -34
- data/guides/04_monitoring.md +223 -25
- data/guides/05_naming.md +0 -1
- data/guides/06_claude.md +96 -0
- data/lib/harnex/adapters/base.rb +4 -8
- data/lib/harnex/adapters/pi.rb +92 -12
- data/lib/harnex/adapters.rb +1 -16
- data/lib/harnex/artifact_report.rb +206 -12
- data/lib/harnex/cli.rb +68 -50
- data/lib/harnex/commands/ask.rb +278 -0
- data/lib/harnex/commands/delegate.rb +202 -0
- data/lib/harnex/commands/doctor.rb +34 -36
- data/lib/harnex/commands/events.rb +3 -3
- data/lib/harnex/commands/history.rb +2 -8
- data/lib/harnex/commands/land.rb +150 -0
- data/lib/harnex/commands/lanes.rb +84 -0
- data/lib/harnex/commands/logs.rb +3 -3
- data/lib/harnex/commands/mcp.rb +208 -0
- data/lib/harnex/commands/orchestration.rb +88 -9
- data/lib/harnex/commands/pane.rb +3 -3
- data/lib/harnex/commands/preflight.rb +566 -0
- data/lib/harnex/commands/reply.rb +125 -0
- data/lib/harnex/commands/result.rb +108 -0
- data/lib/harnex/commands/run.rb +248 -64
- data/lib/harnex/commands/send.rb +121 -16
- data/lib/harnex/commands/status.rb +32 -4
- data/lib/harnex/commands/stop.rb +14 -4
- data/lib/harnex/commands/telemetry.rb +19 -1
- data/lib/harnex/commands/wait.rb +421 -56
- data/lib/harnex/commands/watch.rb +134 -21
- data/lib/harnex/context_file.rb +85 -0
- data/lib/harnex/core.rb +100 -15
- data/lib/harnex/dispatch_history.rb +157 -10
- data/lib/harnex/lanes.rb +513 -0
- data/lib/harnex/mcp.rb +362 -0
- data/lib/harnex/orchestration.rb +128 -5
- data/lib/harnex/owned_process_group.rb +50 -0
- data/lib/harnex/owner_stream.rb +399 -0
- data/lib/harnex/pricing.rb +4 -9
- data/lib/harnex/runtime/activity_tracker.rb +107 -0
- data/lib/harnex/runtime/api_server.rb +11 -1
- data/lib/harnex/runtime/completion_notifier.rb +90 -11
- data/lib/harnex/runtime/inbox.rb +26 -7
- data/lib/harnex/runtime/message.rb +5 -2
- data/lib/harnex/runtime/runtime_budget.rb +96 -0
- data/lib/harnex/runtime/session.rb +684 -294
- data/lib/harnex/runtime/stop_request.rb +39 -0
- data/lib/harnex/stall.rb +46 -0
- data/lib/harnex/telemetry_reconciler.rb +42 -20
- data/lib/harnex/terminal_status.rb +5 -5
- data/lib/harnex/version.rb +2 -2
- data/lib/harnex.rb +16 -0
- data/recipes/01_fire_and_watch.md +14 -14
- data/recipes/02_chain_implement.md +35 -31
- data/recipes/03_buddy.md +1 -1
- metadata +34 -12
- data/docs/codex-appserver.md +0 -175
- data/lib/harnex/adapters/codex.rb +0 -160
- data/lib/harnex/adapters/codex_appserver.rb +0 -407
- data/lib/harnex/codex/app_server/client.rb +0 -347
data/GUIDE.md
CHANGED
|
@@ -2,69 +2,159 @@
|
|
|
2
2
|
|
|
3
3
|
You've installed harnex. Here's how to actually use it.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
harnex hands work to Pi workers (GPT models by default) and gives you, or the
|
|
6
|
+
agent you are working with, the result back as plain text. Each worker runs in
|
|
7
|
+
a visible tmux window you can switch to at any time.
|
|
8
|
+
|
|
9
|
+
## Check the setup
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
harnex doctor # Pi 0.80.4+ on PATH, tmux, retention; MCP integrations
|
|
13
|
+
harnex mcp install # optional: native tools for Claude Code and Pi
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Your first lanes
|
|
17
|
+
|
|
18
|
+
Ask another model a question. The worker reads the repository, answers and
|
|
19
|
+
stops:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
harnex ask "Which module parses the dispatch rows, and is it tested?"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Hand a worker a task in its own git worktree, review it, and land it:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
harnex delegate --worktree word-count \
|
|
29
|
+
"Add TextKit.word_count(text) with a test; run bin/test."
|
|
30
|
+
git diff HEAD...harnex/word-count
|
|
31
|
+
harnex land word-count
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The worker's reply comes back with a footer that says what happened and what
|
|
35
|
+
to do next:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
── word-count: done in 49s · gpt-5.1 · $0.03 · 1 commit, 2 files (+12 -0)
|
|
39
|
+
worktree .harnex/worktrees/word-count (branch harnex/word-count)
|
|
40
|
+
next: review `git diff HEAD...harnex/word-count`, then `harnex land word-count` ...
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Follow up with the same worker; it keeps its context:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
harnex reply word-count "Also add TextKit.char_count(text)."
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Run several at once, then collect them:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
harnex delegate --no-wait --worktree a "Task A"
|
|
53
|
+
harnex delegate --no-wait --worktree b "Task B"
|
|
54
|
+
harnex result
|
|
55
|
+
harnex land
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Commands wait up to 9 minutes; if a worker is still going they exit 124 and
|
|
59
|
+
`harnex result NAME` keeps waiting. `harnex lanes` shows what each worker is
|
|
60
|
+
doing right now. The full guide is [docs/lanes.md](docs/lanes.md); for
|
|
61
|
+
driving harnex from Claude Code or Pi, see [docs/agents.md](docs/agents.md)
|
|
62
|
+
and [docs/mcp.md](docs/mcp.md).
|
|
63
|
+
|
|
64
|
+
## Sessions: the layer underneath
|
|
65
|
+
|
|
66
|
+
Lanes are built on ordinary harnex sessions. The rest of this guide covers
|
|
67
|
+
that layer, which you need for custom orchestration, long-lived interactive
|
|
68
|
+
workers, and wrapping other terminal agents.
|
|
69
|
+
|
|
70
|
+
### Recommended mental model
|
|
6
71
|
|
|
7
72
|
Treat harnex as a local supervisor harness, not as a conversation
|
|
8
73
|
bus between agents.
|
|
9
74
|
|
|
10
75
|
- Start a fresh worker for each step, usually with `--tmux`
|
|
11
|
-
- Give one clear startup task with `--context
|
|
76
|
+
- Give one clear startup task with `--context` (or `--context-file`); add `--auto-stop` for one-shot work
|
|
12
77
|
- Monitor existing visible work with `harnex watch --until done`
|
|
13
78
|
- Use `--wait-for-idle` only as a follow-up-send fence, then verify the artifact
|
|
14
79
|
- Ask the worker to write its output to a file when the next step needs it
|
|
15
80
|
- Stop completed interactive workers promptly
|
|
16
81
|
|
|
17
82
|
For multi-step flows, chain fresh workers with file handoffs:
|
|
18
|
-
|
|
19
|
-
another
|
|
83
|
+
Pi writes a plan, a fresh Pi implements it, Claude (or a fresh Pi
|
|
84
|
+
lane) reviews it, another fresh Pi fixes it.
|
|
20
85
|
|
|
21
|
-
|
|
86
|
+
### Your first session
|
|
22
87
|
|
|
23
|
-
|
|
88
|
+
Pi is the default worker. Check that the installed Pi is new enough
|
|
89
|
+
(0.80.4 or later), then start it through harnex:
|
|
24
90
|
|
|
25
91
|
```bash
|
|
26
|
-
harnex
|
|
92
|
+
harnex doctor
|
|
93
|
+
harnex run pi
|
|
27
94
|
```
|
|
28
95
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
96
|
+
Harnex runs Pi in its structured RPC mode (`pi --mode rpc`) and
|
|
97
|
+
prints the session as a transcript. Harnex runs alongside it —
|
|
98
|
+
registering the session, listening for messages, and tracking
|
|
99
|
+
whether the agent is busy or idle. Claude Code, OpenCode, or any
|
|
100
|
+
other terminal CLI (`harnex run claude`) runs under a PTY instead and
|
|
101
|
+
looks exactly as it does when run directly.
|
|
32
102
|
|
|
33
103
|
Give it a name so other sessions can find it:
|
|
34
104
|
|
|
35
105
|
```bash
|
|
36
|
-
harnex run
|
|
106
|
+
harnex run pi --id pi-i-13
|
|
37
107
|
```
|
|
38
108
|
|
|
39
|
-
|
|
109
|
+
Session IDs follow `<cli>-<role>-<tag>`: `pi-p-13` plans issue 13,
|
|
110
|
+
`pi-i-13` implements it, `pi-f-13` fixes it, and `cl-r-13` is a
|
|
111
|
+
Claude reviewer. See `harnex agents-guide naming`.
|
|
112
|
+
|
|
113
|
+
### Sending messages
|
|
40
114
|
|
|
41
115
|
From another terminal:
|
|
42
116
|
|
|
43
117
|
```bash
|
|
44
|
-
harnex send --id
|
|
118
|
+
harnex send --id pi-i-13 --message "implement the auth module"
|
|
45
119
|
```
|
|
46
120
|
|
|
47
|
-
If the agent is busy,
|
|
48
|
-
|
|
49
|
-
|
|
121
|
+
If the agent is busy, you don't have to wait or retry: a busy Pi
|
|
122
|
+
worker takes the message at once as a follow-up and runs it when the
|
|
123
|
+
current turn ends, and other agents queue it until they are back at a
|
|
124
|
+
prompt. Follow-ups exist, but the default workflow should still be
|
|
50
125
|
one task per fresh worker.
|
|
51
126
|
|
|
52
127
|
For unattended visible dispatch, prefer the native work-level watcher over
|
|
53
128
|
external poll loops:
|
|
54
129
|
|
|
55
130
|
```bash
|
|
56
|
-
harnex run
|
|
57
|
-
--context "Read and execute /tmp/task-impl.md" --auto-stop
|
|
58
|
-
harnex watch --id
|
|
131
|
+
harnex run pi --id pi-i-13 --tmux pi-i-13 \
|
|
132
|
+
--context "Read and execute /tmp/task-impl-13.md" --auto-stop
|
|
133
|
+
harnex watch --id pi-i-13 --until done --max-wait 90m
|
|
59
134
|
```
|
|
60
135
|
|
|
136
|
+
Or launch and wait in one call. `--wait-done` blocks until the first
|
|
137
|
+
turn's result and prints it; the worker's reply is
|
|
138
|
+
`turn_result.final_message`. On exit 124 the worker keeps going; run
|
|
139
|
+
the `resume` command the output names.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
harnex run pi --id pi-i-13 --tmux pi-i-13 \
|
|
143
|
+
--context "Read and execute /tmp/task-impl-13.md" \
|
|
144
|
+
--auto-stop --wait-done --wait-timeout 9m
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Pi RPC cannot show Pi's project-trust prompt, so harnex starts Pi with
|
|
148
|
+
`--no-approve` (project-local Pi resources ignored); pass `-- --approve` to
|
|
149
|
+
load them.
|
|
150
|
+
|
|
61
151
|
`harnex run --watch --preset impl` is a separate foreground launch-and-stall
|
|
62
152
|
babysitter; do not combine it with `--tmux` or `--detach`. For full flag
|
|
63
153
|
behavior and event-stream consumers, see
|
|
64
154
|
[TECHNICAL.md](TECHNICAL.md) and the built-in monitoring section in
|
|
65
155
|
[README.md](README.md).
|
|
66
156
|
|
|
67
|
-
|
|
157
|
+
### Seeing what's running
|
|
68
158
|
|
|
69
159
|
```bash
|
|
70
160
|
harnex status
|
|
@@ -73,59 +163,98 @@ harnex status
|
|
|
73
163
|
Shows all live sessions for the current repo with their ID, CLI
|
|
74
164
|
type, age, and state (prompt/busy).
|
|
75
165
|
|
|
76
|
-
|
|
166
|
+
### Running agents in tmux
|
|
77
167
|
|
|
78
168
|
This is the recommended way to run multiple agents. Each one gets
|
|
79
169
|
its own tmux window you can switch to anytime:
|
|
80
170
|
|
|
81
171
|
```bash
|
|
82
|
-
harnex run
|
|
83
|
-
harnex run claude --id
|
|
172
|
+
harnex run pi --id pi-i-13 --tmux pi-i-13
|
|
173
|
+
harnex run claude --id cl-r-13 --tmux cl-r-13
|
|
84
174
|
```
|
|
85
175
|
|
|
176
|
+
Pass the same value to `--id` and `--tmux` so status, panes, logs,
|
|
177
|
+
and the tmux window name all line up.
|
|
178
|
+
|
|
86
179
|
Switch between them with your normal tmux keys (`Ctrl-b n`,
|
|
87
180
|
`Ctrl-b p`, or `Ctrl-b w` to pick from a list). This is the
|
|
88
|
-
easiest way to monitor what each agent is doing
|
|
89
|
-
|
|
181
|
+
easiest way to monitor what each agent is doing. Claude's window
|
|
182
|
+
shows its normal TUI; Pi's shows harnex's transcript of the RPC
|
|
183
|
+
session rather than Pi's own TUI.
|
|
90
184
|
|
|
91
185
|
For longer-running work, `harnex pane` lets you peek at an
|
|
92
186
|
agent's screen without switching windows:
|
|
93
187
|
|
|
94
188
|
```bash
|
|
95
|
-
harnex pane --id
|
|
189
|
+
harnex pane --id pi-i-13 --lines 30
|
|
96
190
|
```
|
|
97
191
|
|
|
98
192
|
Or watch it live from your current terminal:
|
|
99
193
|
|
|
100
194
|
```bash
|
|
101
|
-
harnex pane --id
|
|
195
|
+
harnex pane --id pi-i-13 --follow
|
|
102
196
|
```
|
|
103
197
|
|
|
104
|
-
|
|
198
|
+
### Raw parallel sessions in worktrees
|
|
199
|
+
|
|
200
|
+
`harnex delegate --worktree` creates and cleans up worktrees for you. To
|
|
201
|
+
manage them yourself with raw sessions, give each its own git worktree.
|
|
202
|
+
`--cwd` starts Pi in the worktree, `--root` keeps the session attributed to
|
|
203
|
+
your main checkout, and harnex credits each session with its own commits:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
git worktree add ../wt-13 -b issue-13
|
|
207
|
+
git worktree add ../wt-14 -b issue-14
|
|
208
|
+
harnex run pi --id pi-i-13 --tmux pi-i-13 --cwd ../wt-13 --root . \
|
|
209
|
+
--context-file /tmp/task-13.md --auto-stop
|
|
210
|
+
harnex run pi --id pi-i-14 --tmux pi-i-14 --cwd ../wt-14 --root . \
|
|
211
|
+
--context-file /tmp/task-14.md --auto-stop
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Watch each with `harnex watch --id`, or, from a Claude Code or Pi
|
|
215
|
+
supervisor, wait for every lane you launched in one call:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
harnex watch --owner --until-idle --timeout 90m
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
A Claude Code subagent shares its parent's session ID; it passes the
|
|
222
|
+
same `--owner-tag TAG` to `harnex run` and `harnex watch --owner` so
|
|
223
|
+
it sees only its own lanes (`harnex agents-guide claude`).
|
|
224
|
+
|
|
225
|
+
### Sending work and waiting for it to finish
|
|
105
226
|
|
|
106
227
|
Use `--wait-for-idle` to block until the agent finishes
|
|
107
228
|
processing:
|
|
108
229
|
|
|
109
230
|
```bash
|
|
110
|
-
harnex send --id
|
|
231
|
+
harnex send --id pi-i-13 --message "implement the plan" --wait-for-idle --timeout 600
|
|
111
232
|
```
|
|
112
233
|
|
|
113
234
|
This is better than separate send + wait commands because there's
|
|
114
235
|
no gap where you might check too early and think the agent is
|
|
115
236
|
done when it hasn't started yet.
|
|
116
237
|
|
|
238
|
+
With Pi, `--wait-done` goes further: it blocks until the turn the
|
|
239
|
+
message started (or joined) settles and prints that turn's result,
|
|
240
|
+
with the same exit codes as `harnex wait --until done`:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
harnex send --id pi-i-13 --message "Also cover the empty-input case." --wait-done --timeout 540
|
|
244
|
+
```
|
|
245
|
+
|
|
117
246
|
Treat `--wait-for-idle` as the fence, not the report. After the
|
|
118
247
|
send returns, use `harnex pane` or `harnex logs` to inspect what
|
|
119
248
|
actually happened.
|
|
120
249
|
|
|
121
|
-
|
|
250
|
+
### Sending large prompts
|
|
122
251
|
|
|
123
|
-
|
|
252
|
+
Shell quoting and terminal input don't love multi-kilobyte inline
|
|
124
253
|
messages. For anything longer than a few sentences, write the
|
|
125
254
|
task to a file and tell the agent to read it:
|
|
126
255
|
|
|
127
256
|
```bash
|
|
128
|
-
cat > /tmp/task-impl.md <<'EOF'
|
|
257
|
+
cat > /tmp/task-impl-13.md <<'EOF'
|
|
129
258
|
Implement phase 2 from koder/plans/03_output_streaming.md.
|
|
130
259
|
|
|
131
260
|
Focus on:
|
|
@@ -136,20 +265,28 @@ Focus on:
|
|
|
136
265
|
Do not modify the CLI commands.
|
|
137
266
|
EOF
|
|
138
267
|
|
|
139
|
-
harnex send --id
|
|
268
|
+
harnex send --id pi-i-13 --message "Read and execute /tmp/task-impl-13.md"
|
|
140
269
|
```
|
|
141
270
|
|
|
142
271
|
If the task is already written down — a plan file, an issue, a
|
|
143
272
|
spec — just point to it:
|
|
144
273
|
|
|
145
274
|
```bash
|
|
146
|
-
harnex send --id
|
|
275
|
+
harnex send --id pi-i-13 --message "Implement koder/plans/plan_09_atomic_send_wait.md"
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
At launch, `--context-file` sends a file's text itself as the task,
|
|
279
|
+
and `--context-section` sends only the part under one heading:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
harnex run pi --id pi-i-13 --tmux pi-i-13 \
|
|
283
|
+
--context-file koder/briefs/13.md --context-section "## Task" --auto-stop
|
|
147
284
|
```
|
|
148
285
|
|
|
149
286
|
This is more reliable, easier to debug (you can read the file to
|
|
150
287
|
see exactly what was sent), and avoids quoting headaches.
|
|
151
288
|
|
|
152
|
-
|
|
289
|
+
### Capturing results
|
|
153
290
|
|
|
154
291
|
For dependable multi-step work, prefer file handoffs over reply
|
|
155
292
|
messages.
|
|
@@ -158,10 +295,10 @@ Examples:
|
|
|
158
295
|
|
|
159
296
|
```bash
|
|
160
297
|
# Planning
|
|
161
|
-
harnex send --id
|
|
298
|
+
harnex send --id pi-p-13 --message "Read koder/issues/13_atomic_send_wait.md and write a plan to /tmp/plan-13.md. Do not change code." --wait-for-idle --timeout 600
|
|
162
299
|
|
|
163
300
|
# Review
|
|
164
|
-
harnex send --id
|
|
301
|
+
harnex send --id cl-r-13 --message "Review the current changes against /tmp/plan-13.md and write findings to /tmp/review-13.md. If clean, say so explicitly." --wait-for-idle --timeout 600
|
|
165
302
|
```
|
|
166
303
|
|
|
167
304
|
Why files work better:
|
|
@@ -170,10 +307,15 @@ Why files work better:
|
|
|
170
307
|
- The supervisor can inspect the artifact without scraping terminal text
|
|
171
308
|
- If the session dies, the output still exists
|
|
172
309
|
|
|
310
|
+
Pi results also carry the worker's last reply as `final_message` (in
|
|
311
|
+
`run --wait-done`, `send --wait-done`, and `watch --owner` output).
|
|
312
|
+
That is enough for a short answer; use a file for anything the next
|
|
313
|
+
step must read.
|
|
314
|
+
|
|
173
315
|
After the worker finishes, inspect the screen:
|
|
174
316
|
|
|
175
317
|
```bash
|
|
176
|
-
harnex pane --id
|
|
318
|
+
harnex pane --id cl-r-13 --lines 60
|
|
177
319
|
```
|
|
178
320
|
|
|
179
321
|
**Return channel for any tmux pane:** Every spawned session gets
|
|
@@ -189,59 +331,68 @@ If you're inside a harnex-managed session, you can also use
|
|
|
189
331
|
`$HARNEX_ID` as the return address with `harnex send`. But file
|
|
190
332
|
handoffs remain the preferred primary control flow.
|
|
191
333
|
|
|
192
|
-
|
|
334
|
+
### Stopping agents
|
|
193
335
|
|
|
194
336
|
```bash
|
|
195
|
-
harnex stop --id
|
|
337
|
+
harnex stop --id pi-i-13
|
|
196
338
|
```
|
|
197
339
|
|
|
198
|
-
|
|
199
|
-
|
|
340
|
+
For Pi, harnex aborts any running turn and ends the `pi --mode rpc`
|
|
341
|
+
process. PTY agents get their native exit sequence (e.g. `/exit` for
|
|
342
|
+
Claude). Either way the agent shuts down cleanly.
|
|
200
343
|
|
|
201
|
-
|
|
344
|
+
### A reliable supervised workflow
|
|
202
345
|
|
|
203
|
-
Use fresh instances for each stage.
|
|
204
|
-
Claude only reviews.
|
|
346
|
+
Use fresh instances for each stage. Pi plans, implements, and fixes.
|
|
347
|
+
Claude (or a fresh Pi lane) only reviews.
|
|
205
348
|
|
|
206
349
|
```bash
|
|
207
|
-
# 1. Plan with
|
|
208
|
-
harnex run
|
|
209
|
-
harnex send --id
|
|
210
|
-
harnex pane --id
|
|
211
|
-
harnex stop --id
|
|
212
|
-
|
|
213
|
-
# 2. Implement with a fresh
|
|
214
|
-
harnex run
|
|
215
|
-
harnex send --id
|
|
216
|
-
harnex pane --id
|
|
217
|
-
harnex stop --id
|
|
350
|
+
# 1. Plan with Pi
|
|
351
|
+
harnex run pi --id pi-p-13 --tmux pi-p-13
|
|
352
|
+
harnex send --id pi-p-13 --message "Read koder/issues/13_atomic_send_wait.md and write a concrete implementation plan to /tmp/plan-13.md. Do not change code." --wait-for-idle --timeout 600
|
|
353
|
+
harnex pane --id pi-p-13 --lines 60
|
|
354
|
+
harnex stop --id pi-p-13
|
|
355
|
+
|
|
356
|
+
# 2. Implement with a fresh Pi
|
|
357
|
+
harnex run pi --id pi-i-13 --tmux pi-i-13
|
|
358
|
+
harnex send --id pi-i-13 --message "Read /tmp/plan-13.md, implement it, run tests, and write a short summary to /tmp/impl-13.md." --wait-for-idle --timeout 1200
|
|
359
|
+
harnex pane --id pi-i-13 --lines 80
|
|
360
|
+
harnex stop --id pi-i-13
|
|
218
361
|
|
|
219
362
|
# 3. Review with a fresh Claude
|
|
220
|
-
harnex run claude --id cl-
|
|
221
|
-
harnex send --id cl-
|
|
222
|
-
harnex pane --id cl-
|
|
223
|
-
harnex stop --id cl-
|
|
363
|
+
harnex run claude --id cl-r-13 --tmux cl-r-13
|
|
364
|
+
harnex send --id cl-r-13 --message "Review the current changes against /tmp/plan-13.md. Write findings to /tmp/review-13.md. If there are no issues, say clean." --wait-for-idle --timeout 900
|
|
365
|
+
harnex pane --id cl-r-13 --lines 80
|
|
366
|
+
harnex stop --id cl-r-13
|
|
224
367
|
```
|
|
225
368
|
|
|
226
|
-
If the review finds issues, spawn
|
|
227
|
-
it to read `/tmp/review-13.md`, fix the findings, run tests, and
|
|
228
|
-
an updated summary. Then review again with a fresh Claude
|
|
369
|
+
If the review finds issues, spawn a fresh Pi fixer (`pi-f-13`) and
|
|
370
|
+
tell it to read `/tmp/review-13.md`, fix the findings, run tests, and
|
|
371
|
+
write an updated summary. Then review again with a fresh Claude
|
|
372
|
+
instance, or a fresh Pi lane (`pi-r-13`) that has not seen the
|
|
373
|
+
implementation.
|
|
374
|
+
|
|
375
|
+
Each Pi step can also be one blocking call:
|
|
376
|
+
`harnex run pi --id pi-p-13 --tmux pi-p-13 --context "..." --auto-stop --wait-done --wait-timeout 9m`.
|
|
229
377
|
|
|
230
378
|
## Teaching agents about harnex
|
|
231
379
|
|
|
232
|
-
|
|
233
|
-
|
|
380
|
+
The smoothest way is `harnex mcp install`: Claude Code and Pi get the lane
|
|
381
|
+
commands as native tools, and Claude Code gets a `gpt` subagent (see
|
|
382
|
+
[docs/agents.md](docs/agents.md)). Harnex also ships its agent guidance in the
|
|
383
|
+
CLI; no skill install or project-local docs are required:
|
|
234
384
|
|
|
235
385
|
```bash
|
|
236
386
|
harnex agents-guide # list all agent guide topics
|
|
237
387
|
harnex agents-guide dispatch # Fire and Watch lifecycle
|
|
238
388
|
harnex agents-guide monitoring # completion signals and polling
|
|
239
389
|
harnex agents-guide naming # session IDs and artifact names
|
|
390
|
+
harnex agents-guide claude # Pi workers as tools from Claude Code
|
|
240
391
|
```
|
|
241
392
|
|
|
242
393
|
Tell an agent to run `harnex --help` and then `harnex agents-guide`.
|
|
243
394
|
The guides cover dispatch, chain implementation, buddies, monitoring,
|
|
244
|
-
and
|
|
395
|
+
naming conventions, and Claude Code using Pi workers as tools.
|
|
245
396
|
|
|
246
397
|
## Recipes
|
|
247
398
|
|
|
@@ -257,14 +408,17 @@ harnex agents-guide # deeper agent-facing guidance
|
|
|
257
408
|
- **Fire and Watch** (`harnex recipes show 01`) — send work to a
|
|
258
409
|
fresh worker, watch its tmux screen, capture the result, stop it.
|
|
259
410
|
- **Chain Implement** (`harnex recipes show 02`) — process a
|
|
260
|
-
batch as repeated fire-and-watch:
|
|
261
|
-
|
|
411
|
+
batch as repeated fire-and-watch: Pi plan/implement, Claude (or a
|
|
412
|
+
fresh Pi lane) review, Pi fix, then review again if needed.
|
|
262
413
|
- **Buddy** (`harnex recipes show 03`) — spawn an accountability
|
|
263
414
|
partner for overnight or long-running work. The buddy polls the
|
|
264
415
|
worker's screen and nudges it if it stalls.
|
|
265
416
|
|
|
266
417
|
## What's next
|
|
267
418
|
|
|
419
|
+
For lanes, MCP and coding agents, see [docs/lanes.md](docs/lanes.md),
|
|
420
|
+
[docs/mcp.md](docs/mcp.md) and [docs/agents.md](docs/agents.md); upgrading
|
|
421
|
+
from an older release, [docs/upgrading-to-0.29.md](docs/upgrading-to-0.29.md).
|
|
268
422
|
For the full command reference, flags, HTTP API, and internals,
|
|
269
423
|
see [TECHNICAL.md](TECHNICAL.md). The packaged
|
|
270
424
|
[dispatch telemetry](docs/dispatch-telemetry.md) and
|