agent-director 0.4.0 → 0.4.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.
- package/README.md +62 -0
- package/dist/client.d.ts +99 -0
- package/dist/errors.d.ts +173 -0
- package/dist/ffi.d.ts +42 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +603 -0
- package/dist/internal/bindingSpec.d.ts +37 -0
- package/dist/internal/bootstrapFfi.d.ts +37 -0
- package/dist/internal/freeGuard.d.ts +39 -0
- package/dist/internal/tilde.d.ts +16 -0
- package/dist/internal/tsOnlyErrors.d.ts +25 -0
- package/dist/internal/verbs.d.ts +57 -0
- package/dist/internal/worker.d.ts +36 -0
- package/dist/internal/workerProxy.d.ts +45 -0
- package/dist/platform.d.ts +80 -0
- package/dist/types.d.ts +301 -0
- package/package.json +18 -5
- package/scripts/postinstall.ts +646 -0
- package/skills/install-agent-director/SKILL.md +481 -0
- package/skills/install-agent-director/install.sh +620 -0
- package/skills/install-agent-director/uninstall.sh +210 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: install-agent-director
|
|
3
|
+
description: Install (or upgrade) agent-director on this machine. Runs the bundled install.sh against the user's ~/ — creates ~/.agent-director/ with the binary, warms up state.db, and injects two persistent `agent-director help` hooks into ~/.claude/settings.json (SessionStart + SessionEnd reason=compact). Use this skill when the user says "install agent-director", "set up agent-director", or "upgrade agent-director on this machine".
|
|
4
|
+
version: 0.4.2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to invoke
|
|
8
|
+
|
|
9
|
+
Trigger phrases: "install agent-director", "set up agent-director",
|
|
10
|
+
"upgrade agent-director on this machine".
|
|
11
|
+
|
|
12
|
+
## Operator dialog (do BEFORE running install.sh)
|
|
13
|
+
|
|
14
|
+
`install.sh` has flags that materially change the install. Do NOT pick
|
|
15
|
+
them silently. Walk the operator through each choice with
|
|
16
|
+
`AskUserQuestion`, echo the resolved flag set back for confirmation,
|
|
17
|
+
then execute. Keep it tight — four questions, then a confirm.
|
|
18
|
+
|
|
19
|
+
### How to phrase each question
|
|
20
|
+
|
|
21
|
+
**Assume the operator has never seen this project before.** Don't lead
|
|
22
|
+
with the flag name. Each `AskUserQuestion` must include four parts,
|
|
23
|
+
in this order:
|
|
24
|
+
|
|
25
|
+
1. **What this choice means** — one sentence of plain-English context.
|
|
26
|
+
What is `--symlink-dir`? What is MCP? Don't assume.
|
|
27
|
+
2. **The options, with the trade-off** — not just "a, b, or c" but
|
|
28
|
+
*why you'd pick each one*. Mark the recommended option.
|
|
29
|
+
3. **The default**, clearly labeled, and *why* it's the default given
|
|
30
|
+
what was detected about this machine.
|
|
31
|
+
4. **What happens if they get it wrong** — one phrase. Is it
|
|
32
|
+
reversible? Does it break things, or just produce a suboptimal
|
|
33
|
+
setup the next uninstall can fix?
|
|
34
|
+
|
|
35
|
+
If a question reads like "Binary source (`--binary <path>`): use this,
|
|
36
|
+
or point elsewhere?" you have failed. That is a question for someone
|
|
37
|
+
who already knows what the script does. Rewrite it.
|
|
38
|
+
|
|
39
|
+
### How the install writes the binary
|
|
40
|
+
|
|
41
|
+
The install script copies the new binary into a sibling temp file
|
|
42
|
+
under `~/.agent-director/bin/`, then `mv`s it over the canonical
|
|
43
|
+
`~/.agent-director/bin/agent-director`. `mv` within one filesystem
|
|
44
|
+
is atomic at the inode level, so concurrent readers see either the
|
|
45
|
+
old binary or the new — never a half-written file. A running process
|
|
46
|
+
(say, an in-flight Spawn whose hooks reference this binary) holds the
|
|
47
|
+
old inode, so its current exec is unaffected by the swap.
|
|
48
|
+
|
|
49
|
+
The previous binary is *not* retained by default. Pass `--keep-prior`
|
|
50
|
+
on upgrade to have install.sh snapshot the existing binary to
|
|
51
|
+
`~/.agent-director/bin/agent-director.prior` before the swap. That
|
|
52
|
+
gives you a one-step rollback (`mv .prior canonical`); without it,
|
|
53
|
+
re-install the previous tag via `install.sh --from-release v<old>`.
|
|
54
|
+
|
|
55
|
+
### The four questions
|
|
56
|
+
|
|
57
|
+
1. **Where should the binary come from? (`--from-release` / `--binary <path>`)**
|
|
58
|
+
|
|
59
|
+
- *What this is:* agent-director is a single Go binary. The
|
|
60
|
+
install script copies that binary into `~/.agent-director/bin/`
|
|
61
|
+
and adds it to your PATH. We need to know where to copy *from*.
|
|
62
|
+
- *Four options:*
|
|
63
|
+
- **(a) Download a pre-built release from GitHub** *(recommended
|
|
64
|
+
for new users)*. The script `curl -L`s the right asset for
|
|
65
|
+
your OS/arch from
|
|
66
|
+
`https://github.com/gabemahoney/agent-director/releases/latest`.
|
|
67
|
+
No Go toolchain needed. Flag: `--from-release`.
|
|
68
|
+
- **(b) Use a binary already built or downloaded locally.** If
|
|
69
|
+
you've run `make build` in a checkout, point at `./bin/agent-director`.
|
|
70
|
+
If you downloaded a tarball yourself, point at that. Flag:
|
|
71
|
+
`--binary <path>`.
|
|
72
|
+
- **(c) Use whatever `agent-director` is on `PATH` today.** Only
|
|
73
|
+
makes sense if you're re-installing or upgrading an existing
|
|
74
|
+
install. The script falls back to this automatically if
|
|
75
|
+
neither (a) nor (b) is specified.
|
|
76
|
+
- **(d) Build from source now, then install.** Run `make build` in
|
|
77
|
+
this checkout to produce a fresh `./bin/agent-director`, then
|
|
78
|
+
point install.sh at it. No install.sh change needed: the
|
|
79
|
+
orchestrator runs `make build` first, then
|
|
80
|
+
`install.sh --binary ./bin/agent-director`. Prereq: Go 1.22+ on
|
|
81
|
+
PATH.
|
|
82
|
+
- *Default:* depends on what the orchestrator detects about the
|
|
83
|
+
launch environment. As of b.q3b, install.sh refuses option (b)
|
|
84
|
+
when `./bin/agent-director`'s embedded commit doesn't match
|
|
85
|
+
`git rev-parse HEAD` — so "use the local binary" is only proposed
|
|
86
|
+
when it's provably fresh.
|
|
87
|
+
- **In a checked-out tree, Go available, `./bin/agent-director`
|
|
88
|
+
exists AND `agent-director version` reports a `commit` that
|
|
89
|
+
matches `git rev-parse HEAD`** → propose **(b)** *use the
|
|
90
|
+
local binary*. It's the artifact of this exact source tree;
|
|
91
|
+
no rebuild needed.
|
|
92
|
+
- **In a checked-out tree with Go available but no fresh local
|
|
93
|
+
binary** (missing, or `commit` doesn't match HEAD) → propose
|
|
94
|
+
**(d)** *build from source*. The orchestrator runs `make build`
|
|
95
|
+
to produce a binary that matches the current tree, then points
|
|
96
|
+
install.sh at it.
|
|
97
|
+
- **In a checked-out tree but no Go (or `make build` would fail)**
|
|
98
|
+
→ propose **(a)** *download from release* and SAY SO. Don't try
|
|
99
|
+
to use a possibly-stale `./bin/agent-director`.
|
|
100
|
+
- **Not in a checked-out tree** (install.sh was curled to a tmp
|
|
101
|
+
path, or invoked from an arbitrary directory) → propose **(a)**
|
|
102
|
+
*download from release*.
|
|
103
|
+
|
|
104
|
+
**Why the version-check matters:** absent a check, a binary at
|
|
105
|
+
`./bin/agent-director` may have been built off a stale branch or a
|
|
106
|
+
previous session's incomplete edit. Installing it silently
|
|
107
|
+
substitutes "trust what was compiled before" for the operator's
|
|
108
|
+
likely intent of "install the current source". install.sh now reads
|
|
109
|
+
the binary's `version` verb and refuses option (b) unless the
|
|
110
|
+
embedded commit matches HEAD — so the orchestrator can safely
|
|
111
|
+
default to (b) when fresh, and falls through to (d)/(a) when not.
|
|
112
|
+
|
|
113
|
+
- *Reversibility:* picking wrong is cheap. The next
|
|
114
|
+
`uninstall.sh --purge` resets to a clean slate, and you can
|
|
115
|
+
re-run `install.sh` with a different source any time.
|
|
116
|
+
|
|
117
|
+
If `--from-release` is selected but the repo has no releases yet,
|
|
118
|
+
the script exits with a clear error. Don't paper over that —
|
|
119
|
+
surface it to the operator and loop back to (b) or (c).
|
|
120
|
+
|
|
121
|
+
2. **Should the binary go on `PATH` via a symlink? (`--symlink-dir <dir>` or `--no-symlink`)**
|
|
122
|
+
|
|
123
|
+
- *What this is:* the binary lives at
|
|
124
|
+
`~/.agent-director/bin/agent-director`. For you to type
|
|
125
|
+
`agent-director` from any shell, that directory needs to be on
|
|
126
|
+
`PATH`, **or** we need to drop a symlink somewhere that already
|
|
127
|
+
is. A symlink is a file that points at another file — running it
|
|
128
|
+
runs the target.
|
|
129
|
+
- *Options:*
|
|
130
|
+
- **(a) Drop a symlink in `~/.local/bin`** *(recommended if it
|
|
131
|
+
exists and is on PATH)*. This is the standard place for
|
|
132
|
+
per-user binaries on Linux/macOS.
|
|
133
|
+
- **(b) Drop a symlink in some other PATH directory** (e.g.
|
|
134
|
+
`~/bin`, `/usr/local/bin`). Pass the directory.
|
|
135
|
+
- **(c) Skip the symlink entirely (`--no-symlink`)**. You invoke
|
|
136
|
+
agent-director via the full path
|
|
137
|
+
`~/.agent-director/bin/agent-director`, or add that bin/
|
|
138
|
+
directory to `PATH` yourself.
|
|
139
|
+
- *Default:* (a) if `~/.local/bin` exists and is already on
|
|
140
|
+
`PATH`. Otherwise ask explicitly — don't silently fall back to
|
|
141
|
+
(c), because the operator probably wants a working command.
|
|
142
|
+
- *Reversibility:* fully reversible. The uninstall script removes
|
|
143
|
+
any symlink it created. If you skip and want one later, re-run
|
|
144
|
+
`install.sh --symlink-dir <dir>`.
|
|
145
|
+
|
|
146
|
+
3. **Register the MCP server with Claude Code? (`--register-mcp`)**
|
|
147
|
+
|
|
148
|
+
- *What this is:* MCP (Model Context Protocol) is how Claude Code
|
|
149
|
+
learns about external tool servers and exposes their operations
|
|
150
|
+
as first-class typed tools. Registering agent-director as an
|
|
151
|
+
MCP server makes its verbs (`spawn`, `send-keys`, `read-pane`,
|
|
152
|
+
etc.) appear in any Claude session's tool list as
|
|
153
|
+
`mcp__agent-director__spawn` and friends — typed inputs,
|
|
154
|
+
structured outputs, schema-validated, no shell-escaping
|
|
155
|
+
headaches. *This does NOT affect whether Claudes can drive
|
|
156
|
+
agent-director* — they can call the CLI via their `Bash` tool
|
|
157
|
+
either way. It only changes whether agent-director's API is
|
|
158
|
+
exposed as a typed tool surface or has to be shelled out to.
|
|
159
|
+
- *Options:*
|
|
160
|
+
- **(a) Register now (`--register-mcp`).** The script runs
|
|
161
|
+
`claude mcp add agent-director -- <path> serve --stdio`.
|
|
162
|
+
agent-director's verbs become typed MCP tools in every
|
|
163
|
+
Claude session. Pick this for orchestrator setups, or any
|
|
164
|
+
workflow where you want Claudes to discover agent-director's
|
|
165
|
+
API automatically.
|
|
166
|
+
- **(b) Skip.** agent-director stays a CLI: a Claude can still
|
|
167
|
+
call it via `Bash` (e.g. `agent-director spawn ...`), and
|
|
168
|
+
humans use it from the shell. Pick this if you don't want it
|
|
169
|
+
cluttering every session's MCP tool list, or you'll only call
|
|
170
|
+
it from scripts/cron.
|
|
171
|
+
- *Default:* (b) — OFF. MCP registration is the right call for
|
|
172
|
+
orchestrator setups, but off-by-default keeps the tool list
|
|
173
|
+
lean for operators who don't need it. Easy to flip on later.
|
|
174
|
+
- *Reversibility:* fully reversible. To add it later:
|
|
175
|
+
`claude mcp add agent-director -- ~/.agent-director/bin/agent-director serve --stdio`.
|
|
176
|
+
To remove: `claude mcp remove agent-director` or
|
|
177
|
+
`uninstall.sh --mcp-also`.
|
|
178
|
+
|
|
179
|
+
4. **Inject persistent help hooks into `~/.claude/settings.json`? (`--no-hooks`)**
|
|
180
|
+
|
|
181
|
+
- *What this is:* agent-director ships a `help` verb that prints
|
|
182
|
+
its entire manifest (every verb, every error code) as JSON. The
|
|
183
|
+
install adds two hook entries to `~/.claude/settings.json` that
|
|
184
|
+
fire `agent-director help` at two moments:
|
|
185
|
+
- **SessionStart** — when any Claude Code session starts under
|
|
186
|
+
your user, the manifest is piped into the new session's
|
|
187
|
+
context, so the model knows the verb surface from turn 1.
|
|
188
|
+
- **SessionEnd with matcher=compact** — fires just before
|
|
189
|
+
`/compact` truncates context, so the post-compact Claude
|
|
190
|
+
still knows what verbs exist.
|
|
191
|
+
Without these hooks, every Claude that wants to drive
|
|
192
|
+
agent-director has to be hand-told what verbs exist — either by
|
|
193
|
+
pasting `agent-director help` into a prompt, or by relying on
|
|
194
|
+
the operator-Claude to introduce the API surface.
|
|
195
|
+
- *Options:*
|
|
196
|
+
- **(a) Inject the hooks** *(recommended for almost all
|
|
197
|
+
installs)*. The merge is additive — existing user hooks at
|
|
198
|
+
those events are preserved, and re-running the install is
|
|
199
|
+
idempotent (duplicate entries are detected and skipped). The
|
|
200
|
+
install also snapshots `~/.claude/settings.json` to a
|
|
201
|
+
timestamped `.bak` first.
|
|
202
|
+
- **(b) Skip the hook injection (`--no-hooks`)**. Pick this if
|
|
203
|
+
you want to manage how Claudes learn about agent-director
|
|
204
|
+
yourself (e.g. via per-project CLAUDE.md, hand-paste, or some
|
|
205
|
+
other mechanism). With this flag, settings.json is left
|
|
206
|
+
byte-identical to its pre-install state — no edit, no .bak.
|
|
207
|
+
- *Default:* (a) — inject. This is the single biggest reason
|
|
208
|
+
install.sh exists over a bare binary copy. Defaulting to skip
|
|
209
|
+
would make the install almost useless for the orchestrator use
|
|
210
|
+
case.
|
|
211
|
+
- *Reversibility:* fully reversible. `uninstall.sh` removes the
|
|
212
|
+
two entries (preserving any other user hooks at those events),
|
|
213
|
+
and the pre-edit `.bak` snapshot is retained for manual
|
|
214
|
+
rollback. Re-injecting later is a re-run of `install.sh`
|
|
215
|
+
without `--no-hooks`.
|
|
216
|
+
|
|
217
|
+
5. **Confirm and execute**
|
|
218
|
+
- Display the assembled `bash install.sh <resolved flags>` command
|
|
219
|
+
line back to the operator.
|
|
220
|
+
- Ask "ready to run?" with `AskUserQuestion`. Only on an explicit
|
|
221
|
+
"yes" execute the script. A "no" or any modification answer means
|
|
222
|
+
loop back to the relevant question, not silently re-pick.
|
|
223
|
+
- If this is an upgrade and the operator wants a single-step
|
|
224
|
+
rollback path, add `--keep-prior`. Otherwise leave it off;
|
|
225
|
+
a re-install with `--from-release v<old>` is the fallback.
|
|
226
|
+
|
|
227
|
+
Do NOT skip this dialog because flags "look obvious from context".
|
|
228
|
+
The operator may want a non-default path, MCP off, or a `--keep-prior`
|
|
229
|
+
rollback snapshot. Inferring intent is the failure mode this section
|
|
230
|
+
exists to prevent.
|
|
231
|
+
|
|
232
|
+
## What this skill does
|
|
233
|
+
|
|
234
|
+
This skill runs `install.sh` from the same directory. The script:
|
|
235
|
+
|
|
236
|
+
1. **Pre-flights.** Runs the following checks in order; any failure
|
|
237
|
+
aborts with exit code `2` and a clear message:
|
|
238
|
+
|
|
239
|
+
1. **Whitespace-in-install-path** — `$HOME` must not contain
|
|
240
|
+
whitespace (SRD §4.3; tmux's direct-argv invocation requires
|
|
241
|
+
shell-safe paths).
|
|
242
|
+
2. **OS/CPU gate (SR-2.1).** `uname -s` / `uname -m` must report
|
|
243
|
+
one of the supported tuples: `Linux/x86_64` or `Darwin/arm64`.
|
|
244
|
+
Every other combination (Windows, FreeBSD, `Linux/aarch64`,
|
|
245
|
+
`Darwin/x86_64`, etc.) is hard-refused with a message naming
|
|
246
|
+
the supported set and referencing Idea Bee `b.fg3` for
|
|
247
|
+
cross-platform expansion status.
|
|
248
|
+
3. **Required tools on PATH.** `claude`, `tmux`, `jq`, and
|
|
249
|
+
`file` must all resolve via `command -v`. The `file(1)` tool
|
|
250
|
+
is mandatory because step 6 below relies on it to probe
|
|
251
|
+
`--binary` artifacts (never silent-skip per SR-2.2);
|
|
252
|
+
install via `apt install file` / `brew install file-formula`
|
|
253
|
+
/ `dnf install file`. `curl` is also required when
|
|
254
|
+
`--from-release` is supplied.
|
|
255
|
+
4. **`--from-release` resolution** (if applicable) — downloads
|
|
256
|
+
the matching asset for `$(uname -s)`/`$(uname -m)` from GitHub
|
|
257
|
+
Releases; optional `--sha256` verifies the asset.
|
|
258
|
+
5. **`--binary` path/executability resolution** — settles
|
|
259
|
+
`BINARY_SRC` from `--binary <path>`, the in-repo build, or
|
|
260
|
+
`command -v agent-director`; verifies it is an executable
|
|
261
|
+
regular file.
|
|
262
|
+
6. **`--binary` architecture probe (SR-2.2).** Runs `file(1)`
|
|
263
|
+
against `BINARY_SRC` and pattern-matches against the host
|
|
264
|
+
pair captured by step 2:
|
|
265
|
+
- `Linux/x86_64`: file output must contain `ELF 64-bit LSB`
|
|
266
|
+
AND (`x86-64` OR `x86_64`).
|
|
267
|
+
- `Darwin/arm64`: file output must contain `Mach-O` AND
|
|
268
|
+
(`arm64` OR `arm64e`).
|
|
269
|
+
|
|
270
|
+
Mismatch (e.g. operator passes a darwin-arm64 artifact on
|
|
271
|
+
Linux/x86_64) aborts with exit `2` and a message naming the
|
|
272
|
+
binary, the detected architecture excerpt, and the host pair.
|
|
273
|
+
The probe is independent of the OS/CPU gate above: even on a
|
|
274
|
+
supported host, a wrong-arch binary is refused here.
|
|
275
|
+
7. **Source-tree version check** — when the binary came from a
|
|
276
|
+
local source (`--binary` or the in-repo build) AND install.sh
|
|
277
|
+
lives inside a git checkout, the binary's embedded commit
|
|
278
|
+
must match `HEAD`. Catches the "operator forgot to
|
|
279
|
+
`make build` after pulling new code" footgun.
|
|
280
|
+
|
|
281
|
+
2. **Creates `~/.agent-director/`** (mode 0700) if missing, plus
|
|
282
|
+
`~/.agent-director/bin/` for the binary.
|
|
283
|
+
|
|
284
|
+
3. **Copies the binary** to `~/.agent-director/bin/agent-director`
|
|
285
|
+
(mode 0755). The source is determined by:
|
|
286
|
+
- `--from-release [tag]` if supplied — the script downloads the
|
|
287
|
+
asset for this host's OS/arch from GitHub Releases (resolving
|
|
288
|
+
the latest tag via `gh` or `curl + jq` if none was given), OR
|
|
289
|
+
- `--binary <path>` if supplied, OR
|
|
290
|
+
- `$(dirname $0)/../../bin/agent-director` (the in-repo build) if
|
|
291
|
+
this skill was invoked from a checked-out tree, OR
|
|
292
|
+
- the currently-running `agent-director` resolved via `command -v`.
|
|
293
|
+
|
|
294
|
+
With `--from-release`, an optional `--sha256 <hex>` flag verifies
|
|
295
|
+
the downloaded asset against an expected hash before install.
|
|
296
|
+
|
|
297
|
+
On upgrade (existing binary detected), the new binary is written
|
|
298
|
+
to a sibling temp file (`agent-director.tmp.$$`) and `mv`'d over
|
|
299
|
+
the canonical path. `mv` within one filesystem is atomic at the
|
|
300
|
+
inode level — concurrent readers see either the old binary or
|
|
301
|
+
the new, never half; a running process holds the old inode, so an
|
|
302
|
+
in-flight exec is unaffected by the swap. With `--keep-prior` the
|
|
303
|
+
prior binary is snapshotted to `agent-director.prior` before the
|
|
304
|
+
swap for a one-step rollback.
|
|
305
|
+
|
|
306
|
+
4. **Rejects whitespace in the install path.** Per SRD §4.3 tmux's
|
|
307
|
+
direct-argv invocation does not tolerate spaces in the binary
|
|
308
|
+
path; the script aborts up front rather than failing mysteriously
|
|
309
|
+
later.
|
|
310
|
+
|
|
311
|
+
5. **Warms up the database.** Runs `agent-director help` once so
|
|
312
|
+
`internal/store.ensureSchema` creates `state.db` (mode 0600) and
|
|
313
|
+
stamps the schema version.
|
|
314
|
+
|
|
315
|
+
6. **Injects persistent hooks** into `~/.claude/settings.json`
|
|
316
|
+
(unless `--no-hooks` was passed):
|
|
317
|
+
- `SessionStart` → `agent-director help`
|
|
318
|
+
- `SessionEnd` with matcher `reason=compact` → `agent-director help`
|
|
319
|
+
|
|
320
|
+
These re-inject the verb list into a new conversation so the
|
|
321
|
+
model knows the supervision API surface after a `/compact` or
|
|
322
|
+
fresh session. Mirrors how `bees sting` keeps its skill list
|
|
323
|
+
alive across compacts.
|
|
324
|
+
|
|
325
|
+
The merge is additive: existing user hooks are preserved. Re-running
|
|
326
|
+
the install is idempotent — duplicate entries are detected and
|
|
327
|
+
skipped. The pre-edit contents of `settings.json` are snapshotted
|
|
328
|
+
to a timestamped `.bak` sibling before the merge writes.
|
|
329
|
+
|
|
330
|
+
With `--no-hooks`, this step is skipped entirely: settings.json is
|
|
331
|
+
not read, not backed up, not written — left byte-identical to its
|
|
332
|
+
pre-install state. The post-install summary reports
|
|
333
|
+
`hooks : skipped (--no-hooks)`.
|
|
334
|
+
|
|
335
|
+
7. **Optional MCP registration.** With `--register-mcp`, runs
|
|
336
|
+
`claude mcp add agent-director ~/.agent-director/bin/agent-director serve --stdio`.
|
|
337
|
+
Skipped by default — operators who don't want the MCP server
|
|
338
|
+
never see it advertised inside Claude.
|
|
339
|
+
|
|
340
|
+
8. **Optional PATH symlink.** With `--symlink-dir <dir>`, drops a
|
|
341
|
+
symlink at `<dir>/agent-director` pointing at the canonical
|
|
342
|
+
binary. Default: `~/.local/bin` if it exists and is on PATH;
|
|
343
|
+
otherwise no symlink (the operator can invoke the full path or
|
|
344
|
+
add `~/.agent-director/bin` to PATH manually).
|
|
345
|
+
|
|
346
|
+
## What this skill does NOT do
|
|
347
|
+
|
|
348
|
+
- It does NOT modify any per-Spawn hooks. Those are injected inline
|
|
349
|
+
via `--settings` at spawn time and are NOT persistent in the
|
|
350
|
+
user's `settings.json`.
|
|
351
|
+
- It does NOT touch existing user hooks in any event.
|
|
352
|
+
- It does NOT install `claude` or `tmux` themselves. Those are
|
|
353
|
+
pre-flight requirements.
|
|
354
|
+
|
|
355
|
+
## Uninstall
|
|
356
|
+
|
|
357
|
+
### Operator dialog (do BEFORE running uninstall.sh)
|
|
358
|
+
|
|
359
|
+
Uninstall has destructive flags that erase state and external
|
|
360
|
+
registrations. Drive an `AskUserQuestion` dialog for each before
|
|
361
|
+
invoking the script. Three questions, then a confirm.
|
|
362
|
+
|
|
363
|
+
Same content-shape rule as the install dialog: each question must
|
|
364
|
+
include (1) what the choice means in plain English, (2) the
|
|
365
|
+
trade-off between the options, (3) the default and why, (4) what's
|
|
366
|
+
at stake if you pick wrong — and here especially, **what is
|
|
367
|
+
irreversible**. Uninstall deletes things; the operator needs to know
|
|
368
|
+
which deletes are recoverable from the filesystem and which are not.
|
|
369
|
+
|
|
370
|
+
What the script removes *unconditionally* (the operator does not need
|
|
371
|
+
to opt into these): the two help-hooks injected into
|
|
372
|
+
`~/.claude/settings.json`, the binary under
|
|
373
|
+
`~/.agent-director/bin/`, and the PATH symlink if one exists. State
|
|
374
|
+
the baseline up front so the questions are only about the
|
|
375
|
+
destructive *additions*.
|
|
376
|
+
|
|
377
|
+
1. **Also delete `state.db` and templates? (`--purge`)**
|
|
378
|
+
|
|
379
|
+
- *What this is:* by default uninstall removes the binary and
|
|
380
|
+
hooks but leaves `~/.agent-director/` itself in place — so
|
|
381
|
+
`state.db` (the SQLite database with every Spawn's id,
|
|
382
|
+
transcript pointer, and history) and any templates you've
|
|
383
|
+
created with `make-template` survive. `--purge` adds
|
|
384
|
+
`rm -rf ~/.agent-director/` on top.
|
|
385
|
+
- *Options:*
|
|
386
|
+
- **(a) Keep state (default).** Re-installing later picks up
|
|
387
|
+
your existing Spawn history and templates.
|
|
388
|
+
- **(b) Purge everything (`--purge`).** Clean-slate
|
|
389
|
+
uninstall. Good if you're done with agent-director for
|
|
390
|
+
good, or troubleshooting a corrupt state.db.
|
|
391
|
+
- *Default:* (a). Don't delete user data without an explicit
|
|
392
|
+
ask.
|
|
393
|
+
- *Reversibility:* **(b) is destructive and irreversible.**
|
|
394
|
+
`state.db` is not backed up. Templates are not backed up. The
|
|
395
|
+
JSONL transcripts of each Spawn live under
|
|
396
|
+
`~/.claude/projects/` and survive — but their mapping to
|
|
397
|
+
claude_instance_ids is in `state.db`, so a purge means you'd
|
|
398
|
+
have to grep transcripts by hand to find a specific session.
|
|
399
|
+
|
|
400
|
+
2. **Skip the script's `[y/N]` safety prompt? (`--force`)** *(only ask if (b) above was chosen)*
|
|
401
|
+
|
|
402
|
+
- *What this is:* with `--purge`, `uninstall.sh` prints
|
|
403
|
+
`--purge will rm -rf ~/.agent-director/ — proceed? [y/N]`
|
|
404
|
+
and waits for a reply. `--force` suppresses that prompt.
|
|
405
|
+
- *Options:*
|
|
406
|
+
- **(a) Keep the prompt (default).** One more chance to back
|
|
407
|
+
out at the shell.
|
|
408
|
+
- **(b) Skip it (`--force`).** The `AskUserQuestion` you just
|
|
409
|
+
answered counts as confirmation; the extra prompt is
|
|
410
|
+
redundant.
|
|
411
|
+
- *Default:* (a). Belt-and-suspenders by default; the operator
|
|
412
|
+
can opt into (b) explicitly.
|
|
413
|
+
- *Reversibility:* once `--force` plus `--purge` runs, the
|
|
414
|
+
directory is gone with no further chance to abort. The
|
|
415
|
+
`--force` flag itself does nothing without `--purge`.
|
|
416
|
+
|
|
417
|
+
3. **Also deregister the MCP server? (`--mcp-also`)**
|
|
418
|
+
|
|
419
|
+
- *What this is:* if you installed with `--register-mcp`,
|
|
420
|
+
Claude Code remembers agent-director in its MCP server
|
|
421
|
+
list. Without `--mcp-also`, that registration outlives the
|
|
422
|
+
uninstall — Claude Code will still list agent-director but
|
|
423
|
+
fail to connect to it.
|
|
424
|
+
- *Options:*
|
|
425
|
+
- **(a) Leave the MCP registration alone (default).** Pick
|
|
426
|
+
this if you never registered MCP, or you want to keep the
|
|
427
|
+
registration for a later re-install.
|
|
428
|
+
- **(b) Also run `claude mcp remove agent-director`.** Pick
|
|
429
|
+
this if you registered MCP and want a clean
|
|
430
|
+
no-agent-director-at-all state.
|
|
431
|
+
- *Default:* (a). The `claude mcp remove` command is harmless
|
|
432
|
+
if there's no registration, but defaulting it on would imply
|
|
433
|
+
the operator registered MCP — which they may not have.
|
|
434
|
+
- *Reversibility:* completely reversible. Re-register at any
|
|
435
|
+
time with
|
|
436
|
+
`claude mcp add agent-director ~/.agent-director/bin/agent-director serve --stdio`.
|
|
437
|
+
|
|
438
|
+
4. **Confirm and execute**
|
|
439
|
+
- Display the assembled `bash uninstall.sh <resolved flags>`.
|
|
440
|
+
- Ask "ready to run?". Only on explicit "yes" execute.
|
|
441
|
+
|
|
442
|
+
### What uninstall.sh does
|
|
443
|
+
|
|
444
|
+
- Removes the two help hook entries (only the entries this skill
|
|
445
|
+
added; other user hooks are preserved).
|
|
446
|
+
- Removes the binary at `~/.agent-director/bin/agent-director` and
|
|
447
|
+
the `.prior` snapshot if one is present.
|
|
448
|
+
- Unlinks the PATH symlink if one was created.
|
|
449
|
+
- With `--purge`: also removes `~/.agent-director/` entirely
|
|
450
|
+
(including state.db + templates). Requires confirmation unless
|
|
451
|
+
`--force` is supplied.
|
|
452
|
+
- With `--mcp-also`: runs `claude mcp remove agent-director`.
|
|
453
|
+
|
|
454
|
+
## Upgrade rollback
|
|
455
|
+
|
|
456
|
+
If you used `install.sh --keep-prior` on the previous install, the
|
|
457
|
+
previous binary is at `~/.agent-director/bin/agent-director.prior`.
|
|
458
|
+
To roll back:
|
|
459
|
+
|
|
460
|
+
mv ~/.agent-director/bin/agent-director.prior \
|
|
461
|
+
~/.agent-director/bin/agent-director
|
|
462
|
+
|
|
463
|
+
If you didn't pass `--keep-prior`, re-install the previous version via
|
|
464
|
+
`install.sh --from-release v<old-tag>`.
|
|
465
|
+
|
|
466
|
+
There's no automatic rollback because v1 has no migration story (per
|
|
467
|
+
SRD §19 Q11); a schema-incompat upgrade means `rm state.db` and re-warm.
|
|
468
|
+
|
|
469
|
+
## ErrSchemaMismatch recovery
|
|
470
|
+
|
|
471
|
+
If `agent-director help` reports `ErrSchemaMismatch` after an
|
|
472
|
+
upgrade:
|
|
473
|
+
|
|
474
|
+
1. Inspect: `sqlite3 ~/.agent-director/state.db "PRAGMA user_version"`.
|
|
475
|
+
2. v1 has no migrations: `rm ~/.agent-director/state.db*`.
|
|
476
|
+
3. Re-run `agent-director help` to recreate at the current version.
|
|
477
|
+
|
|
478
|
+
Spawn history is lost, but live Spawns whose `claude_instance_id`
|
|
479
|
+
is in the operator's notes can be re-resumed via `agent-director
|
|
480
|
+
resume` — the JSONL transcripts persist in `~/.claude/projects/`
|
|
481
|
+
independently of our DB.
|