harnex 0.5.0 → 0.6.2
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 +154 -0
- data/GUIDE.md +11 -11
- data/README.md +22 -16
- data/TECHNICAL.md +44 -60
- data/guides/01_dispatch.md +139 -0
- data/guides/02_chain.md +113 -0
- data/guides/03_buddy.md +94 -0
- data/guides/04_monitoring.md +130 -0
- data/guides/05_naming.md +106 -0
- data/lib/harnex/adapters/base.rb +10 -0
- data/lib/harnex/adapters/codex_appserver.rb +411 -0
- data/lib/harnex/adapters.rb +16 -3
- data/lib/harnex/cli.rb +16 -6
- data/lib/harnex/commands/agents_guide.rb +109 -0
- data/lib/harnex/commands/doctor.rb +83 -0
- data/lib/harnex/commands/events.rb +10 -0
- data/lib/harnex/commands/guide.rb +9 -0
- data/lib/harnex/commands/logs.rb +10 -0
- data/lib/harnex/commands/pane.rb +10 -0
- data/lib/harnex/commands/recipes.rb +9 -0
- data/lib/harnex/commands/run.rb +22 -4
- data/lib/harnex/commands/send.rb +13 -1
- data/lib/harnex/commands/status.rb +10 -0
- data/lib/harnex/commands/stop.rb +10 -0
- data/lib/harnex/commands/wait.rb +119 -3
- data/lib/harnex/core.rb +2 -2
- data/lib/harnex/runtime/session.rb +227 -1
- data/lib/harnex/runtime/session_state.rb +7 -0
- data/lib/harnex/version.rb +2 -2
- data/lib/harnex.rb +2 -1
- metadata +11 -9
- data/lib/harnex/commands/skills.rb +0 -226
- data/skills/close/SKILL.md +0 -47
- data/skills/harnex/SKILL.md +0 -20
- data/skills/harnex-buddy/SKILL.md +0 -104
- data/skills/harnex-chain/SKILL.md +0 -132
- data/skills/harnex-dispatch/SKILL.md +0 -294
- data/skills/open/SKILL.md +0 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7c3f452ed6de7b0468cbafff82c603beb7f880458168a9acf433d4f2747bbd9
|
|
4
|
+
data.tar.gz: 24ff11cfd9f02d509e7f0720589dc4658c7acff5eefea78029146f292b3010e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d401086cf7cc01a563a34901076175c769ceb06165ef5d875dc5f1ebb722b241ec02b43d7d086575ef2fb78186f30ba3f427fc8dcd0984d44c8ce5accf13527
|
|
7
|
+
data.tar.gz: 10927dc8202b920ef3cdd5dd0a9e728c56e6673bc19cf5fac58f3aea85a52a6ac4b5cabd8a11f856152c3f492241c17e11e1b7a155809283554894784eb301a5
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.6.2] — 2026-05-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- App-server adapter: `--context` delivery and `harnex send` mid-session
|
|
8
|
+
now succeed without `--legacy-pty`. Previously both raised
|
|
9
|
+
`NotImplementedError` from `build_send_payload` on the stdio_jsonrpc
|
|
10
|
+
transport — `--context` boot fired a `disconnected source=transport`
|
|
11
|
+
event and the session never registered; `harnex send` timed out at
|
|
12
|
+
120s with `delivery timed out`. Closes #29.
|
|
13
|
+
|
|
14
|
+
### Notes
|
|
15
|
+
|
|
16
|
+
- `--legacy-pty` is no longer required for any normal dispatch flow.
|
|
17
|
+
Removal still scheduled for 0.7.0 per the 0.6.1 deprecation note.
|
|
18
|
+
|
|
19
|
+
## [0.6.1] — 2026-05-06
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `harnex agents-guide [topic]` exposes dispatch, chain, buddy,
|
|
24
|
+
monitoring, and naming guidance from the installed CLI.
|
|
25
|
+
- `harnex --help` now points agents to `harnex agents-guide`.
|
|
26
|
+
- `harnex help <command>` entries now include common patterns and gotchas for
|
|
27
|
+
agent dispatch workflows.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- `harnex skills install` and `harnex skills uninstall`.
|
|
32
|
+
- Bundled `skills/` sources and repo-local skill symlinks. Agents now discover
|
|
33
|
+
guidance through `harnex --help` and `harnex agents-guide`.
|
|
34
|
+
|
|
35
|
+
### Notes
|
|
36
|
+
|
|
37
|
+
- `--legacy-pty` removal is still scheduled for 0.7.0.
|
|
38
|
+
- `man harnex` was deferred; the CLI-native `agents-guide` path satisfies the
|
|
39
|
+
agent-discovery acceptance test without adding a man-page build dependency.
|
|
40
|
+
|
|
41
|
+
## 0.6.0 — 2026-05-06
|
|
42
|
+
|
|
43
|
+
### Architectural pivot: Codex on JSON-RPC
|
|
44
|
+
|
|
45
|
+
harnex now speaks `codex app-server` JSON-RPC over stdio for the
|
|
46
|
+
Codex adapter. Pane-scraping is retired for Codex. Closed by
|
|
47
|
+
construction:
|
|
48
|
+
|
|
49
|
+
- #22 (Codex side; `--watch --stall-after` still applies to
|
|
50
|
+
claude/generic)
|
|
51
|
+
- #24 (disconnect detection — `error` notifications and JSON-RPC
|
|
52
|
+
error responses replace screen-text regex)
|
|
53
|
+
- #25 (first-class completion signal — `turn/completed` is it)
|
|
54
|
+
|
|
55
|
+
### New
|
|
56
|
+
|
|
57
|
+
- `harnex wait --until task_complete` — block until a turn completes.
|
|
58
|
+
Example: `harnex wait --id cx-i-242 --until task_complete`.
|
|
59
|
+
Adapter-agnostic; tails the events JSONL.
|
|
60
|
+
- `harnex status --json` includes `last_completed_at`, `model`,
|
|
61
|
+
`effort`, `auto_disconnects`.
|
|
62
|
+
- `harnex doctor` preflight checks Codex CLI ≥ 0.128.0.
|
|
63
|
+
- `Adapter#transport` and `Adapter#describe` extension points so
|
|
64
|
+
callers can introspect adapter contracts. Default is
|
|
65
|
+
`:pty` for backward compatibility.
|
|
66
|
+
|
|
67
|
+
### Migration
|
|
68
|
+
|
|
69
|
+
- Codex CLI ≥ 0.128.0 required.
|
|
70
|
+
- Existing `harnex run codex ...` invocations work unchanged.
|
|
71
|
+
- Emergency fallback: `harnex run codex --legacy-pty ...` (the
|
|
72
|
+
pre-0.6.0 PTY adapter). Deprecated; will be removed in 0.7.0.
|
|
73
|
+
|
|
74
|
+
### Cross-repo
|
|
75
|
+
|
|
76
|
+
- Resolves holm #201 from the harnex side. holm #271 (substrate v2
|
|
77
|
+
meta) tracks the broader pivot.
|
|
78
|
+
|
|
79
|
+
## 0.5.0 — 2026-05-01
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
- `harnex run --meta '<JSON>'` — per-dispatch metadata intake captured into
|
|
84
|
+
the `started` event for downstream telemetry analysis.
|
|
85
|
+
- `harnex run --summary-out PATH` — appends one consolidated dispatch
|
|
86
|
+
telemetry record per session (`meta` + `predicted` + `actual` blocks) to
|
|
87
|
+
a project-local file. Default target is `<repo>/koder/DISPATCH.jsonl`.
|
|
88
|
+
- Token usage + git telemetry capture: new `usage`, `git`, and `summary`
|
|
89
|
+
events emitted on session end with input/output/reasoning/cached tokens,
|
|
90
|
+
wall time, cost, LOC changed, files changed, and commits made.
|
|
91
|
+
|
|
92
|
+
### Notes
|
|
93
|
+
|
|
94
|
+
- Closes #23 (dispatch telemetry capture). Additive — `events`
|
|
95
|
+
`schema_version` stays at `1`.
|
|
96
|
+
- Authoritative DISPATCH record schema is maintained in the consumer
|
|
97
|
+
project (holm `koder/DISPATCH.schema.md`); harnex implements what is
|
|
98
|
+
required and leaves non-extractable fields explicitly `null`.
|
|
99
|
+
|
|
100
|
+
## 0.4.0 — 2026-04-30
|
|
101
|
+
|
|
102
|
+
### Added — Built-in dispatch monitoring (#22, Layers 1–4)
|
|
103
|
+
|
|
104
|
+
- **Layer 1**: `log_mtime` and `log_idle_s` exposed in `harnex status`
|
|
105
|
+
payloads, with an `IDLE` column in text mode.
|
|
106
|
+
- **Layer 2**: `harnex run --watch --stall-after DUR --max-resumes N`
|
|
107
|
+
blocking babysitter for fire-and-watch workflows. Auto-resumes a
|
|
108
|
+
stalled session up to `N` times. Legacy file-hook mode preserved via
|
|
109
|
+
the renamed `--watch-file` flag.
|
|
110
|
+
- **Layer 3**: `harnex run --preset impl|plan|gate` resolves
|
|
111
|
+
stall/resume defaults; explicit `--stall-after` / `--max-resumes`
|
|
112
|
+
flags still override.
|
|
113
|
+
- **Layer 4**: `harnex events --id <session>` JSONL stream with v1
|
|
114
|
+
schema (envelope: `schema_version`, `seq`, `ts`, `id`, `type`); emits
|
|
115
|
+
`started`, `send`, `exited` events. `send.msg` truncated to 200 chars
|
|
116
|
+
with `msg_truncated` flag. File transport at
|
|
117
|
+
`~/.local/state/harnex/events/<repo>--<id>.jsonl`. Stability promise:
|
|
118
|
+
`schema_version: 1` means additive-only changes.
|
|
119
|
+
|
|
120
|
+
### Notes
|
|
121
|
+
|
|
122
|
+
- Layer 5 (codex stream-disconnect detection) was deferred at 0.4.0
|
|
123
|
+
close to avoid regex-heuristic stalls. Later closed by construction
|
|
124
|
+
in 0.6.0 via the Codex app-server adapter (#24, #27).
|
|
125
|
+
|
|
126
|
+
## 0.3.4 — 2026-04-24
|
|
127
|
+
|
|
128
|
+
### Changed
|
|
129
|
+
|
|
130
|
+
- Skill catalogue collapsed: `harnex` orchestrator skill merged into
|
|
131
|
+
`dispatch`; `chain-implement` rewritten as a cohesive set;
|
|
132
|
+
cross-references audited end-to-end. Closes #21.
|
|
133
|
+
|
|
134
|
+
### Notes
|
|
135
|
+
|
|
136
|
+
- The bundled skills system was later removed entirely in 0.6.1
|
|
137
|
+
(superseded by CLI-discoverable `harnex agents-guide`).
|
|
138
|
+
|
|
139
|
+
## 0.3.3 — 2026-04-23
|
|
140
|
+
|
|
141
|
+
### Fixed
|
|
142
|
+
|
|
143
|
+
- `--tmux` no longer greedily consumes the next flag as the window
|
|
144
|
+
name. Previously `harnex run codex --tmux --id foo` was parsed as
|
|
145
|
+
`--tmux="--id"`, dropping the explicit session ID. Closes #20.
|
|
146
|
+
|
|
147
|
+
## 0.3.2 — 2026-04-19
|
|
148
|
+
|
|
149
|
+
### Fixed
|
|
150
|
+
|
|
151
|
+
- State detection for cursor-addressed TUIs (Codex v0.121+). The
|
|
152
|
+
cursor-positioning escape sequences emitted by newer Codex versions
|
|
153
|
+
were confusing the prompt detector, leaving sessions stuck in
|
|
154
|
+
`unknown` state.
|
data/GUIDE.md
CHANGED
|
@@ -223,22 +223,21 @@ If the review finds issues, spawn another fresh Codex worker and tell
|
|
|
223
223
|
it to read `/tmp/review-13.md`, fix the findings, run tests, and write
|
|
224
224
|
an updated summary. Then review again with a fresh Claude instance.
|
|
225
225
|
|
|
226
|
-
## Teaching
|
|
226
|
+
## Teaching agents about harnex
|
|
227
227
|
|
|
228
|
-
Harnex ships
|
|
229
|
-
|
|
228
|
+
Harnex ships its agent guidance in the CLI. No skill install or
|
|
229
|
+
project-local docs are required:
|
|
230
230
|
|
|
231
231
|
```bash
|
|
232
|
-
harnex
|
|
232
|
+
harnex agents-guide # list all agent guide topics
|
|
233
|
+
harnex agents-guide dispatch # Fire and Watch lifecycle
|
|
234
|
+
harnex agents-guide monitoring # completion signals and polling
|
|
235
|
+
harnex agents-guide naming # session IDs and artifact names
|
|
233
236
|
```
|
|
234
237
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
use harnex commands without being taught how. The skills activate
|
|
239
|
-
automatically when agent collaboration is needed.
|
|
240
|
-
|
|
241
|
-
For repo-local installs instead, use `--local`.
|
|
238
|
+
Tell an agent to run `harnex --help` and then `harnex agents-guide`.
|
|
239
|
+
The guides cover dispatch, chain implementation, buddies, monitoring,
|
|
240
|
+
and naming conventions.
|
|
242
241
|
|
|
243
242
|
## Recipes
|
|
244
243
|
|
|
@@ -248,6 +247,7 @@ from the CLI:
|
|
|
248
247
|
```bash
|
|
249
248
|
harnex recipes # list all recipes
|
|
250
249
|
harnex recipes show 01 # read one
|
|
250
|
+
harnex agents-guide # deeper agent-facing guidance
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
- **Fire and Watch** (`harnex recipes show 01`) — send work to a
|
data/README.md
CHANGED
|
@@ -12,14 +12,17 @@ gem install harnex
|
|
|
12
12
|
|
|
13
13
|
Requires **Ruby 3.x**. No other dependencies.
|
|
14
14
|
|
|
15
|
-
Then
|
|
15
|
+
Then ask the CLI what to do next:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
harnex
|
|
18
|
+
harnex
|
|
19
|
+
harnex --help
|
|
20
|
+
harnex agents-guide
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
`harnex agents-guide` is the agent-facing reference for dispatch, chain,
|
|
24
|
+
buddy, monitoring, and naming patterns. It is packaged in the gem; no skills
|
|
25
|
+
or project-local docs are required.
|
|
23
26
|
|
|
24
27
|
## What it does
|
|
25
28
|
|
|
@@ -90,19 +93,23 @@ harnex send --id cl-review --message "Review changes against /tmp/plan.md, write
|
|
|
90
93
|
harnex stop --id cl-review
|
|
91
94
|
```
|
|
92
95
|
|
|
93
|
-
Harnex ships
|
|
96
|
+
Harnex ships CLI-readable agent guides for this pattern:
|
|
94
97
|
|
|
95
|
-
- **[Dispatch](
|
|
98
|
+
- **[Dispatch](guides/01_dispatch.md)** — the fire-and-watch pattern:
|
|
96
99
|
spawn an agent, poll its screen, stop it when done
|
|
97
|
-
- **[Chain](
|
|
100
|
+
- **[Chain](guides/02_chain.md)** — end-to-end issue-to-code
|
|
98
101
|
workflow: plan, review plan, implement, review code, fix
|
|
99
|
-
- **[Buddy](
|
|
102
|
+
- **[Buddy](guides/03_buddy.md)** — spawn an accountability partner
|
|
100
103
|
for long-running or overnight work
|
|
104
|
+
- **[Monitoring](guides/04_monitoring.md)** — completion signals and
|
|
105
|
+
poll/watch patterns
|
|
106
|
+
- **[Naming](guides/05_naming.md)** — session IDs, task files, done markers
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
Read them from the installed CLI:
|
|
103
109
|
|
|
104
110
|
```bash
|
|
105
|
-
harnex
|
|
111
|
+
harnex agents-guide dispatch
|
|
112
|
+
harnex agents-guide monitoring
|
|
106
113
|
```
|
|
107
114
|
|
|
108
115
|
## Built-in dispatch monitoring
|
|
@@ -110,7 +117,7 @@ harnex skills install
|
|
|
110
117
|
For unattended dispatches, use `--watch` instead of writing a bash poll loop:
|
|
111
118
|
|
|
112
119
|
```bash
|
|
113
|
-
harnex run codex --id cx-impl-42 --
|
|
120
|
+
harnex run codex --id cx-impl-42 --watch --preset impl \
|
|
114
121
|
--context "Implement koder/plans/42_plan.md. Run tests and commit when done."
|
|
115
122
|
```
|
|
116
123
|
|
|
@@ -208,19 +215,18 @@ See [recipes/03_buddy.md](recipes/03_buddy.md) for the full pattern.
|
|
|
208
215
|
| `harnex events --id <id>` | Stream structured session events (`--snapshot` for non-blocking dump) |
|
|
209
216
|
| `harnex wait --id <id>` | Block until exit or a target state |
|
|
210
217
|
| `harnex guide` | Getting started walkthrough |
|
|
218
|
+
| `harnex agents-guide` | Agent-facing dispatch, chain, buddy, monitoring, and naming guides |
|
|
211
219
|
| `harnex recipes` | Tested workflow patterns |
|
|
212
|
-
| `harnex skills install` | Install bundled skills for Claude/Codex |
|
|
213
|
-
| `harnex skills uninstall` | Remove installed skills |
|
|
214
220
|
|
|
215
221
|
## Uninstalling
|
|
216
222
|
|
|
217
223
|
```bash
|
|
218
|
-
harnex skills uninstall # remove skills from ~/.claude/ and ~/.codex/
|
|
219
224
|
gem uninstall harnex
|
|
220
225
|
```
|
|
221
226
|
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
If you installed harnex skills with an older release, those copies are no
|
|
228
|
+
longer used. Remove stale `~/.claude/skills/harnex-*` or
|
|
229
|
+
`~/.codex/skills/harnex-*` entries manually if you want to clean them up.
|
|
224
230
|
|
|
225
231
|
## Going deeper
|
|
226
232
|
|
data/TECHNICAL.md
CHANGED
|
@@ -321,7 +321,25 @@ The adapter reads the screen and returns a state hash:
|
|
|
321
321
|
| `confirmation` | `false` | Modal confirmation |
|
|
322
322
|
| `unknown` | `nil` | Can't determine |
|
|
323
323
|
|
|
324
|
-
### Codex Adapter
|
|
324
|
+
### Codex Adapter (default — JSON-RPC `app-server`)
|
|
325
|
+
|
|
326
|
+
- `transport :stdio_jsonrpc` — speaks JSON-RPC 2.0 over the
|
|
327
|
+
subprocess's stdin/stdout, one JSON object per line.
|
|
328
|
+
- Launches `codex app-server` (Codex CLI ≥ 0.128.0; verify with
|
|
329
|
+
`harnex doctor`).
|
|
330
|
+
- Notifications (`turn/started`, `turn/completed`, `item/completed`,
|
|
331
|
+
`error`, `thread/compacted`, …) fan into the events log.
|
|
332
|
+
`task_complete` is the harnex-side event for `turn/completed`.
|
|
333
|
+
- Disconnect is detected from JSON-RPC error responses, subprocess
|
|
334
|
+
EOF, parse errors, or a server `error` notification — no screen
|
|
335
|
+
regex required.
|
|
336
|
+
- Synthesized transcript: `item/completed` text payloads stream to
|
|
337
|
+
both the output log and STDOUT so tmux/pane workflows continue to
|
|
338
|
+
work without a real PTY.
|
|
339
|
+
- See `docs/codex-appserver.md` for the full mapping table and
|
|
340
|
+
troubleshooting.
|
|
341
|
+
|
|
342
|
+
#### Codex Adapter (legacy PTY — `--legacy-pty`, removal in 0.7.0)
|
|
325
343
|
|
|
326
344
|
- Launches with `--no-alt-screen` for inline screen output
|
|
327
345
|
- Detects prompt by looking for `›` prefix in recent lines
|
|
@@ -557,77 +575,43 @@ Harnex uses Ruby threads, not processes:
|
|
|
557
575
|
All shared state is protected by `Mutex`. The `SessionState`
|
|
558
576
|
and `Inbox` classes use `ConditionVariable` for signaling.
|
|
559
577
|
|
|
560
|
-
##
|
|
578
|
+
## Agent Guides
|
|
561
579
|
|
|
562
|
-
Harnex ships
|
|
563
|
-
dispatch discipline. The canonical collaboration skill is:
|
|
580
|
+
Harnex ships agent-facing guidance as Markdown files packaged inside the gem:
|
|
564
581
|
|
|
565
582
|
```
|
|
566
|
-
|
|
583
|
+
guides/01_dispatch.md
|
|
584
|
+
guides/02_chain.md
|
|
585
|
+
guides/03_buddy.md
|
|
586
|
+
guides/04_monitoring.md
|
|
587
|
+
guides/05_naming.md
|
|
567
588
|
```
|
|
568
589
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
The dispatch skill tells agents:
|
|
572
|
-
|
|
573
|
-
- How to detect they're inside a harnex session (env vars)
|
|
574
|
-
- How to define return channels before delegation
|
|
575
|
-
- How to send short, file-referenced tasks with explicit reply instructions
|
|
576
|
-
- How to send messages, check status, spawn workers, and stop safely
|
|
577
|
-
- How to use `--context`, `--force`, `--no-wait`
|
|
578
|
-
- Relay header format and behavior
|
|
579
|
-
- Collaboration patterns (reply, supervisor, file watch)
|
|
580
|
-
- Safety rules (confirm before sending, no auto-loops)
|
|
581
|
-
|
|
582
|
-
### How agents load skills
|
|
583
|
-
|
|
584
|
-
Claude and Codex both support a `skills/` directory. When a
|
|
585
|
-
skill is present, the agent can use harnex commands without
|
|
586
|
-
being told how — the skill provides the instructions.
|
|
587
|
-
|
|
588
|
-
Skill files use YAML frontmatter:
|
|
589
|
-
|
|
590
|
-
```yaml
|
|
591
|
-
---
|
|
592
|
-
name: harnex-dispatch
|
|
593
|
-
description: Fire & Watch dispatch pattern...
|
|
594
|
-
allowed-tools: Bash(harnex *)
|
|
595
|
-
---
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
The `allowed-tools` field grants the agent permission to run
|
|
599
|
-
`harnex` commands without asking for approval each time.
|
|
600
|
-
|
|
601
|
-
### Installing bundled skills
|
|
602
|
-
|
|
603
|
-
Use the installer command instead of manual symlinks:
|
|
590
|
+
The files are exposed through the CLI:
|
|
604
591
|
|
|
605
592
|
```bash
|
|
606
|
-
harnex
|
|
607
|
-
harnex
|
|
608
|
-
harnex
|
|
593
|
+
harnex agents-guide
|
|
594
|
+
harnex agents-guide dispatch
|
|
595
|
+
harnex agents-guide monitoring
|
|
609
596
|
```
|
|
610
597
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
- `harnex` -> `harnex-dispatch`
|
|
614
|
-
- `dispatch` -> `harnex-dispatch`
|
|
615
|
-
- `chain-implement` -> `harnex-chain`
|
|
598
|
+
### What's in the guides
|
|
616
599
|
|
|
617
|
-
|
|
600
|
+
The agent guides cover:
|
|
618
601
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
602
|
+
- Detecting harnex session context through environment variables
|
|
603
|
+
- Defining return channels before delegation
|
|
604
|
+
- Short prompts that reference task files
|
|
605
|
+
- Relay header behavior for harnex-to-harnex messages
|
|
606
|
+
- Fire and Watch dispatch lifecycle
|
|
607
|
+
- Chain implementation phase gates
|
|
608
|
+
- Buddy monitoring for unattended work
|
|
609
|
+
- Completion signals, event/log/pane monitoring, and wall-clock caps
|
|
610
|
+
- Session ID, task file, and done marker naming conventions
|
|
628
611
|
|
|
629
|
-
|
|
630
|
-
|
|
612
|
+
Older releases shipped `harnex skills install`; that installer was removed in
|
|
613
|
+
0.6.1. Agents now discover harnex directly with `harnex --help` and
|
|
614
|
+
`harnex agents-guide`.
|
|
631
615
|
|
|
632
616
|
## Known Limitations
|
|
633
617
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Dispatch: Fire and Watch
|
|
2
|
+
|
|
3
|
+
Fire and Watch is the base harnex workflow for agent dispatch:
|
|
4
|
+
|
|
5
|
+
1. Spawn one fresh worker.
|
|
6
|
+
2. Send one scoped task.
|
|
7
|
+
3. Watch for progress with harnex primitives.
|
|
8
|
+
4. Verify the result.
|
|
9
|
+
5. Stop the worker.
|
|
10
|
+
|
|
11
|
+
Use this pattern for implementation, review, fix, mapping, and planning
|
|
12
|
+
sessions. Compose larger workflows by repeating it with file handoffs.
|
|
13
|
+
|
|
14
|
+
## Detect Your Context
|
|
15
|
+
|
|
16
|
+
Inside a harnex-managed session, these environment variables are available:
|
|
17
|
+
|
|
18
|
+
| Variable | Meaning |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `HARNEX_SESSION_CLI` | Wrapped CLI name, such as `codex` or `claude` |
|
|
21
|
+
| `HARNEX_ID` | Current harnex session ID |
|
|
22
|
+
| `HARNEX_SESSION_REPO_ROOT` | Repo root for the session |
|
|
23
|
+
| `HARNEX_SESSION_ID` | Internal harnex instance ID |
|
|
24
|
+
| `HARNEX_SPAWNER_PANE` | Tmux pane ID of the invoker |
|
|
25
|
+
|
|
26
|
+
Use `harnex send`, `harnex status`, `harnex wait`, `harnex pane`, and
|
|
27
|
+
`harnex logs` to coordinate with peers. If you are not inside harnex,
|
|
28
|
+
use a concrete return artifact such as a file path or a tmux pane message.
|
|
29
|
+
|
|
30
|
+
## Return Channel First
|
|
31
|
+
|
|
32
|
+
Decide how results come back before you delegate work.
|
|
33
|
+
|
|
34
|
+
Inside harnex, instruct the peer to reply to your own session:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
harnex send --id cx-i-NN --message "Read /tmp/task-impl-NN.md. When done, send one summary line back to harnex id $HARNEX_ID."
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Outside harnex, require a file or another explicit return path:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
harnex send --id cx-i-NN --message "Read /tmp/task-impl-NN.md. Write final status to /tmp/cx-i-NN-done.txt."
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Do not delegate work without an explicit completion contract.
|
|
47
|
+
|
|
48
|
+
## Spawn
|
|
49
|
+
|
|
50
|
+
Launch worker sessions in tmux when a user or orchestrator may need to inspect
|
|
51
|
+
them live:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
harnex run codex --id cx-i-NN --tmux cx-i-NN \
|
|
55
|
+
--context "Implement the project plan in /tmp/task-impl-NN.md. Run tests when done."
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For long prompts, write the details into a file and reference it. PTYs are more
|
|
59
|
+
reliable with short injected messages.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
harnex run codex --id cx-i-NN --tmux cx-i-NN \
|
|
63
|
+
--context "Read and execute /tmp/task-impl-NN.md"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Rule: when you use `--tmux`, pass the same name as `--id`. If you pass only
|
|
67
|
+
`--tmux NAME`, harnex creates a random session ID and the pane name no longer
|
|
68
|
+
matches `harnex status` or `harnex pane --id`.
|
|
69
|
+
|
|
70
|
+
## Send
|
|
71
|
+
|
|
72
|
+
Use `--message` for short instructions and file references:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
harnex send --id cx-i-NN --message "Continue with /tmp/task-impl-NN.md. Report final status to $HARNEX_ID."
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Use `--wait-for-idle` only as a turn fence. It proves that one send returned to
|
|
79
|
+
an idle state; it is not a full work-completion signal.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
harnex send --id cx-i-NN --message "Run the acceptance test." --wait-for-idle --timeout 900
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Messages sent from one harnex session to another include a relay header:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
[harnex relay from=<cli> id=<sender_id> at=<timestamp>]
|
|
89
|
+
<message body>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Treat relay messages as actionable prompts. Reply with `harnex send --id
|
|
93
|
+
<sender_id> ...` unless the sender provided a different return path.
|
|
94
|
+
|
|
95
|
+
## Watch
|
|
96
|
+
|
|
97
|
+
Use the lightest primitive that gives the signal you need:
|
|
98
|
+
|
|
99
|
+
| Need | Command |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| Current live screen | `harnex pane --id cx-i-NN --lines 40` |
|
|
102
|
+
| Continuous pane view | `harnex pane --id cx-i-NN --follow` |
|
|
103
|
+
| Transcript tail | `harnex logs --id cx-i-NN --lines 80` |
|
|
104
|
+
| Structured events | `harnex events --id cx-i-NN --snapshot` |
|
|
105
|
+
| Native turn completion | `harnex wait --id cx-i-NN --until task_complete` |
|
|
106
|
+
|
|
107
|
+
For unattended policy-only stall recovery, use built-in watch mode:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
harnex run codex --id cx-i-NN --watch --preset impl --context "Read /tmp/task-impl-NN.md"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`--watch` is foreground-blocking. Use it when a single process should launch
|
|
114
|
+
and monitor the worker. Use pane/log/event polling or a buddy when you need
|
|
115
|
+
interpretation, multiple sessions, or a separate watcher.
|
|
116
|
+
|
|
117
|
+
## Verify And Stop
|
|
118
|
+
|
|
119
|
+
Before stopping a worker, verify the expected artifact, test result, commit,
|
|
120
|
+
or review output exists:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
harnex pane --id cx-i-NN --lines 60
|
|
124
|
+
git status --short
|
|
125
|
+
git log --oneline -5
|
|
126
|
+
harnex stop --id cx-i-NN
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Stop completed sessions promptly. Fresh workers are easier to reason about
|
|
130
|
+
than reused workers with stale context.
|
|
131
|
+
|
|
132
|
+
## Recipes
|
|
133
|
+
|
|
134
|
+
For compact command recipes, use:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
harnex recipes show 01
|
|
138
|
+
harnex recipes show fire
|
|
139
|
+
```
|
data/guides/02_chain.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Chain Implementation
|
|
2
|
+
|
|
3
|
+
Chain implementation is Fire and Watch repeated with phase gates. It takes an
|
|
4
|
+
issue or request through planning, review, implementation, review, fixes, and
|
|
5
|
+
release without reusing long-lived worker context.
|
|
6
|
+
|
|
7
|
+
## Roles
|
|
8
|
+
|
|
9
|
+
Keep roles explicit:
|
|
10
|
+
|
|
11
|
+
| Role | Responsibility |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Orchestrator | Dispatches sessions, watches progress, enforces gates |
|
|
14
|
+
| Worker | Performs scoped production work in a fresh session |
|
|
15
|
+
| Reviewer | Reviews one artifact or change set and writes findings |
|
|
16
|
+
| Fixer | Addresses review findings in a fresh session |
|
|
17
|
+
|
|
18
|
+
The orchestrator may be a human or an agent. It should not quietly skip review
|
|
19
|
+
gates, guess around user-blocking questions, or keep piling work into one
|
|
20
|
+
worker after the scope changes.
|
|
21
|
+
|
|
22
|
+
## Default Serial Flow
|
|
23
|
+
|
|
24
|
+
Use this serial flow for most work:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
Issue or request
|
|
28
|
+
-> optional mapping
|
|
29
|
+
-> plan
|
|
30
|
+
-> plan review
|
|
31
|
+
-> plan fix if needed
|
|
32
|
+
-> implement
|
|
33
|
+
-> code review
|
|
34
|
+
-> code fix if needed
|
|
35
|
+
-> verify
|
|
36
|
+
-> release or handoff
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Each arrow is a fresh harnex worker when delegated. Pass state through files:
|
|
40
|
+
the issue, plan, review file, fix summary, test log, or done marker.
|
|
41
|
+
|
|
42
|
+
## Per-Plan Loop
|
|
43
|
+
|
|
44
|
+
For each independently testable plan:
|
|
45
|
+
|
|
46
|
+
1. Start a planner only if the plan does not already exist or needs revision.
|
|
47
|
+
2. Start a reviewer for the plan.
|
|
48
|
+
3. Start a fixer if the review finds blocking issues.
|
|
49
|
+
4. Start an implementation worker.
|
|
50
|
+
5. Start a code reviewer.
|
|
51
|
+
6. Start a code fixer if needed.
|
|
52
|
+
7. Verify tests and state.
|
|
53
|
+
8. Commit or tag only after the gate passes.
|
|
54
|
+
|
|
55
|
+
Do not start implementation with unresolved blocking plan-review findings. Do
|
|
56
|
+
not advance to the next plan with unresolved blocking code-review findings.
|
|
57
|
+
|
|
58
|
+
## Parallel Variant
|
|
59
|
+
|
|
60
|
+
Parallelism is safest in planning and review phases, because those steps can
|
|
61
|
+
write separate artifacts. Keep implementation serial on the main working tree
|
|
62
|
+
unless the user explicitly asks for parallel implementation and you create
|
|
63
|
+
isolated worktrees.
|
|
64
|
+
|
|
65
|
+
Recommended limits:
|
|
66
|
+
|
|
67
|
+
| Lane | Default |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| Planning | Parallel allowed |
|
|
70
|
+
| Plan review | Parallel allowed |
|
|
71
|
+
| Implementation | Serial unless worktrees are explicit |
|
|
72
|
+
| Code review/fix | Serial per implementation |
|
|
73
|
+
|
|
74
|
+
When parallelizing, cap the number of active workers to what the machine and
|
|
75
|
+
CLI provider can handle. A practical upper bound is five Codex sessions across
|
|
76
|
+
all active lanes unless the user requested more.
|
|
77
|
+
|
|
78
|
+
## Worktrees
|
|
79
|
+
|
|
80
|
+
Use worktrees only when they solve a real isolation problem. Commit or otherwise
|
|
81
|
+
make every needed artifact available before creating the worktree, because
|
|
82
|
+
untracked files do not carry over.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git worktree add ../project-plan-NN -b plan/NN main
|
|
86
|
+
cd ../project-plan-NN
|
|
87
|
+
harnex run codex --id cx-i-NN --tmux cx-i-NN \
|
|
88
|
+
--context "Read the project plan and implement this isolated lane."
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Launch and manage the harnex session from the same repo root or pass `--repo`
|
|
92
|
+
when needed. Use `harnex status --all` to inspect sessions across worktrees.
|
|
93
|
+
|
|
94
|
+
## Failure And Escalation
|
|
95
|
+
|
|
96
|
+
Escalate instead of guessing when:
|
|
97
|
+
|
|
98
|
+
- A review asks a user-blocking question.
|
|
99
|
+
- A worker diverges materially from the plan.
|
|
100
|
+
- The working tree is dirty in unexpected files.
|
|
101
|
+
- The same gate fails repeatedly.
|
|
102
|
+
- Monitoring hits the wall-clock cap.
|
|
103
|
+
|
|
104
|
+
Fix loops are useful only while the review finding is concrete and the worker
|
|
105
|
+
has enough context to address it.
|
|
106
|
+
|
|
107
|
+
## Recipe
|
|
108
|
+
|
|
109
|
+
For a compact command walkthrough, use:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
harnex recipes show 02
|
|
113
|
+
```
|