@the-vibe-company/armada 0.2.19 → 0.2.20

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 (3) hide show
  1. package/README.md +6 -4
  2. package/dist/armada.js +230 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ Workers then need no key either: each one's launch message carries a one-time to
34
34
 
35
35
  `armada status` reads the `armada.toml` of the current repository (or the nearest parent directory) and prints:
36
36
 
37
- - **In flight**: tickets an agent holds, with their phase, runtime, last report and pull request. A worker with no report (an `armada report` event recorded through Armada, an `Agent status:` comment or its claim) for longer than `policy.silence_minutes` is flagged `silent`, unless it is waiting on a human (`awaiting-approval`, `blocked`, `ready-to-merge`). A ticket that never had a report falls back to its last sign of life (ticket edit, comment or pull request update).
37
+ - **In flight**: tickets an agent holds, with their phase, runtime, last report and pull request. A worker with no heartbeat for longer than `policy.silence_minutes` is flagged `silent`, unless it is waiting on a human (`awaiting-approval`, `blocked`, `ready-to-merge`). Older workers without heartbeats fall back to reports (an `armada report` event recorded through Armada, an `Agent status:` comment or its claim), then the ticket's last sign of life (ticket edit, comment or pull request update). A live worker without a report for `policy.quiet_minutes` gets a coordinator-only inbox note, not a red dashboard state.
38
38
  - **Launched, not started**: signed in to Armada, the workers launched with a launch token that have not claimed their ticket after `policy.not_started_minutes`, each saying whether the token was never used (the worker never reached its `armada login` line) or used without a claim.
39
39
  - **Ready to start**: tickets without sub-issues that are not started, not held by an agent, have no open pull request, and whose blocked-by tickets are all closed, ranked by what they unlock. Tickets without the ready label, or still in triage, are listed separately.
40
40
  - **Pull requests waiting**: open pull requests with their CI state and mergeability.
@@ -137,13 +137,14 @@ armada answer --note ABC-12 "main moved: bring it in before you ship" # an unso
137
137
 
138
138
  - `ask` reports the `blocked` phase with `Agent status: blocked — question: <first line>` (the rest and the numbered options below it) and adds a `question` item to the coordinator's inbox on Armada. The worker then stops and waits for the answer in its session, and reports the phase it resumes. It finds the ticket like `report`.
139
139
  - `report awaiting-approval` adds a `plan` item with the full message (and the `--plan` block) and worker handle to the coordinator's inbox. Same-phase heartbeats neither duplicate nor reopen it. Answering it, recording a note, leaving the phase or releasing the ticket closes the plan and any pending approval request. For a pre-approved plan (the brief's "Plan" line says which), post the plan with `report implementing --plan-file -` instead: no approval item is needed.
140
- - `inbox` lists the coordinator's open items (questions, plans, requests, hand-backs), silent workers and workers that never started, oldest first. A worker never started (`not-started`) was launched with a launch token and has not claimed its ticket after `policy.not_started_minutes`; the entry says whether the token was never used or used without a claim, names the worker's session when its sign-in gave one, and clears on the claim, when the launch ends (release, merge, revoke) or when a newer launch of the ticket replaces it. A launch on a ticket a session still holds is not followed (a brief made to read a running worker's prompt again launches nobody; a relaunch releases the old claim first). A launched worker counts as in flight from its launch until it shows as not started, so `armada watch` waits for its claim; past that, its entry carries it. A worker is silent when it holds a ticket, its newest event is older than `policy.silence_minutes`, and its phase does not wait on someone else. It reads Armada only (a sign-in, no Linear key) and records that the coordinator is at work, for the dashboard. `--wait` asks Armada every 15 s until `--timeout`; Armada answers "not modified" (HTTP 304, no body) while the inbox holds the same entries, so a waiting coordinator costs one short request per ask and holds nothing open. It marks the items that were not there before with `*`; loop on it. A hand-back handed back again on a new head (or a plan rewritten in place) counts as new.
140
+ - `heartbeat --every 5m --parent <agent-pid>` pings Armada without reading keys from the vault or writing Linear. The brief starts it immediately after claim: Conductor uses `--background` (detached process group and PID file), Claude Code uses the subagent's background Bash. It survives between turns on Cloud and stops when its persistent parent exits or the current worker session ends (release, merge, revoke). If background startup is unsupported or fails, keep manual reports at least every 15 minutes. `[policy] silence_minutes` defaults to 15: no heartbeat means probably stopped; old clients use reports. `quiet_minutes` defaults to 45: alive without a progress report creates a coordinator-only `quiet` inbox note, never an owner item or red dashboard state. Heartbeats draw the timeline's session line; actual reports remain dots.
141
+ - `inbox` lists the coordinator's open items (questions, plans, requests, hand-backs), silent workers and workers that never started, oldest first. A worker never started (`not-started`) was launched with a launch token and has not claimed its ticket after `policy.not_started_minutes`; the entry says whether the token was never used or used without a claim, names the worker's session when its sign-in gave one, and clears on the claim, when the launch ends (release, merge, revoke) or when a newer launch of the ticket replaces it. A launch on a ticket a session still holds is not followed (a brief made to read a running worker's prompt again launches nobody; a relaunch releases the old claim first). A launched worker counts as in flight from its launch until it shows as not started, so `armada watch` waits for its claim; past that, its entry carries it. A worker is silent when it holds a ticket, its last heartbeat (or newest report for an older client) is older than `policy.silence_minutes`, and its phase does not wait on someone else. A live worker with no report for `policy.quiet_minutes` gets a softer `quiet` entry here only. It reads Armada only (a sign-in, no Linear key) and records that the coordinator is at work, for the dashboard. `--wait` asks Armada every 15 s until `--timeout`; Armada answers "not modified" (HTTP 304, no body) while the inbox holds the same entries, so a waiting coordinator costs one short request per ask and holds nothing open. It marks the items that were not there before with `*`; loop on it. A hand-back handed back again on a new head (or a plan rewritten in place) counts as new.
141
142
  - `watch` is how a coordinator keeps listening, run in the background while a worker is in flight. It asks Armada like `inbox --wait` (every 15 s, every 60 s when no worker is in flight, 304 while nothing changed) with no time limit of its own, and exits as soon as something needs the coordinator that it has not been shown yet by `inbox` or `watch` on this machine: it prints the inbox, new items marked `*`. It exits with "nothing to watch" when no worker is in flight and nothing is open. Armada unreachable or answering 5xx only prints a warning and it keeps going, waiting longer each time; a refusal (signed out) ends it. One watch per project and machine: a second one says the first is running. Its state (a lock, the entries shown, the tickets in flight at the last read, the checkout it ran in) lives in `~/.config/armada/watch/`, no secret.
142
143
  - The last line of `inbox`, `watch`, `merge` and `brief` (not `brief --prompt`) says whether to start watching again, for example `2 workers in flight (ABC-1, ABC-2) — keep watching: armada watch`; with `--json`, the same is the `watch` field.
143
144
  - `armada hook stop` is the Claude Code Stop hook `armada init` adds to `.claude/settings.json` (it asks; `--no-stop-hook` leaves it out; `armada doctor` shows it). It reads only armada.toml and the watch state, so it answers at once without the network. It refuses to end the turn, and tells the agent to start `armada watch` in the background, only in the checkout where `armada watch` ran (never a worker's), while the last read had workers in flight and no watch runs. A watch that ended on a refusal lets the turn end, and `ARMADA_STOP_HOOK=off` turns the hook off.
144
145
  - On the dashboard, an item open in the coordinator's inbox for longer than `policy.coordinator_minutes` (default 10) shows "waiting for the coordinator for N min" in "Waiting for you".
145
146
  - A coordinator's own claim is never listed as silent in its inbox: only an exact, nonempty handle match is excluded, not its questions, requests or hand-backs. `inbox` takes the reading coordinator's handle from `ARMADA_COORDINATOR_HANDLE` first, otherwise from both `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` joined as `workspace/session`. Blank values are ignored; with no complete identity, silence detection is unchanged. Local coordinators should set `ARMADA_COORDINATOR_HANDLE` to the handle used for their claim. The same identity is used for every `--wait` poll and the dashboard presence record; the fleet-wide `status` and dashboard silence rules are unchanged.
146
- - `answer` never calls a runtime: deliver the answer first with the runtime guide's message section. It posts `Agent status: <current phase> — answer: …` on the ticket and resolves the item. An item id needs Armada; a ticket id answers that ticket's open questions and plans and also works without it. `--note` records a delivered note as `Agent status: <phase> — note: …`; it accepts a ticket or plan item id and resolves open plans, not questions. These two are the coordinator's records: Armada never reads them as the worker's phase, hand-back or sign of life. Questions, plans and requests can be answered; `merge` resolves hand-backs, and `release` and `merge` resolve the ticket's open questions. A worker that does not report within `policy.silence_minutes` of an answer shows as silent.
147
+ - `answer` never calls a runtime: deliver the answer first with the runtime guide's message section. It posts `Agent status: <current phase> — answer: …` on the ticket and resolves the item. An item id needs Armada; a ticket id answers that ticket's open questions and plans and also works without it. `--note` records a delivered note as `Agent status: <phase> — note: …`; it accepts a ticket or plan item id and resolves open plans, not questions. These two are the coordinator's records: Armada never reads them as the worker's phase, hand-back or sign of life. Questions, plans and requests can be answered; `merge` resolves hand-backs, and `release` and `merge` resolve the ticket's open questions. For older clients without heartbeats, no report within `policy.silence_minutes` of an answer shows as silent. With heartbeats, the report reminder uses `policy.quiet_minutes` instead.
147
148
  - The dashboard adds two kinds of request, signed by the person who made them. In "Waiting for you", **Approve** opens an editable approval (`approved` by default); sending it creates an `answer-request`, just like answering a question. Deliver its text, then `armada answer <request id> "<answer>"`, which resolves the request and its question or plan and names the requester on the ticket (answering the item itself also closes a waiting request). A `launch-request` asks to launch a ready ticket on a profile: launch it as usual; the worker's `armada claim` resolves it and posts who asked. To decline one, `armada answer <request id> "<why>"`: it is closed with the reason and nothing is posted on the ticket.
148
149
 
149
150
  ## Merge a finished pull request (coordinator)
@@ -399,7 +400,8 @@ local_commands = ["npm ci", "npm test"] # run by `armada merge` on a test merge
399
400
  attachments_per_ticket = 20 # images and links together (default 20)
400
401
  attachments_project_mb = 200 # private image bytes per project, MB = 1024² bytes (default 200)
401
402
  attachments_retention_days = 30 # deleted after completion/cancellation by the next project refresh (default 30)
402
- silence_minutes = 15 # a worker with no report for longer is flagged silent (default 15)
403
+ silence_minutes = 15 # no heartbeat for longer flags a worker silent (default 15; reports for older clients)
404
+ quiet_minutes = 45 # live without a report for longer adds a coordinator-only note (default 45)
403
405
  coordinator_minutes = 10 # an inbox item open longer shows "waiting for the coordinator" (default 10)
404
406
  not_started_minutes = 10 # a launched worker that has not claimed after this long shows as not started (default 10; a CLI older than this setting refuses it)
405
407
  plans = "approve" # or "pre-approved": workers post their plan and go on (default "approve")
package/dist/armada.js CHANGED
@@ -993,6 +993,7 @@ var CONFIG_DEFAULTS = {
993
993
  runtimeGroup: "Agent runtime",
994
994
  runtimes: ["Claude Code", "Codex", "Conductor"],
995
995
  silentAfterMinutes: 15,
996
+ quietAfterMinutes: 45,
996
997
  coordinatorMinutes: 10,
997
998
  notStartedMinutes: 10,
998
999
  plans: "approve",
@@ -1110,6 +1111,7 @@ function parseConfig(text, source = CONFIG_FILE) {
1110
1111
  policyT,
1111
1112
  [
1112
1113
  "silence_minutes",
1114
+ "quiet_minutes",
1113
1115
  "silent_after_minutes",
1114
1116
  "coordinator_minutes",
1115
1117
  "not_started_minutes",
@@ -1207,6 +1209,14 @@ function parseConfig(text, source = CONFIG_FILE) {
1207
1209
  problems.push(`"policy.${silenceKey}" must be a positive number`);
1208
1210
  }
1209
1211
  let coordinatorMinutes = CONFIG_DEFAULTS.coordinatorMinutes;
1212
+ let quietAfterMinutes = CONFIG_DEFAULTS.quietAfterMinutes;
1213
+ if (policyT.quiet_minutes !== undefined) {
1214
+ const value = policyT.quiet_minutes;
1215
+ if (typeof value === "number" && Number.isFinite(value) && value > 0)
1216
+ quietAfterMinutes = value;
1217
+ else
1218
+ problems.push('"policy.quiet_minutes" must be a positive number');
1219
+ }
1210
1220
  if (policyT.coordinator_minutes !== undefined) {
1211
1221
  const v = policyT.coordinator_minutes;
1212
1222
  if (typeof v === "number" && Number.isFinite(v) && v > 0)
@@ -1302,6 +1312,7 @@ function parseConfig(text, source = CONFIG_FILE) {
1302
1312
  gates: { requiredChecks, localCommands },
1303
1313
  policy: {
1304
1314
  silentAfterMinutes,
1315
+ quietAfterMinutes,
1305
1316
  coordinatorMinutes,
1306
1317
  notStartedMinutes,
1307
1318
  plans,
@@ -1346,7 +1357,8 @@ repository = ${q(p.repository)}
1346
1357
  # required_checks = ["test"] # CI checks that must be green before a hand-back (default: every check)
1347
1358
 
1348
1359
  [policy]
1349
- silence_minutes = 15 # a worker with no report for longer than this shows as silent
1360
+ silence_minutes = 15 # a worker with no heartbeat for longer than this shows as silent
1361
+ quiet_minutes = 45 # alive but without a report: a coordinator-only note
1350
1362
  coordinator_minutes = 10 # an inbox item open longer than this shows "waiting for the coordinator"
1351
1363
  # not_started_minutes = 10 # a launched worker that has not claimed after this long shows as not started
1352
1364
  # plans = "approve" # or "pre-approved": workers post their plan and go on without waiting
@@ -1638,7 +1650,8 @@ function buildLane(m, allComments, issue, opts) {
1638
1650
  const agent = issue.delegate ?? issue.assignee;
1639
1651
  const flags = [];
1640
1652
  const waitingOnHuman = NEEDS_HUMAN.includes(phase) || phase === "merged";
1641
- const alive = lastReport ?? lastUpdate;
1653
+ const lastHeartbeat = opts.heartbeats?.[issue.id] ?? opts.live?.handles?.[issue.id]?.lastHeartbeatAt ?? null;
1654
+ const alive = lastHeartbeat ?? lastReport ?? lastUpdate;
1642
1655
  if (!waitingOnHuman && opts.now - Date.parse(alive) > opts.silentAfterMinutes * MIN)
1643
1656
  flags.push("silent");
1644
1657
  if (pr?.state === "open" && pr.ci === "failure")
@@ -1668,6 +1681,7 @@ function buildLane(m, allComments, issue, opts) {
1668
1681
  since,
1669
1682
  lastUpdate,
1670
1683
  lastReport,
1684
+ lastHeartbeat,
1671
1685
  statusLine: fresh?.message && phaseSource === "live" ? { summary: fresh.message, at: fresh.at, author: null, url: issue.url, plan: false } : withStatus?.status ? {
1672
1686
  summary: withStatus.status.summary,
1673
1687
  at: withStatus.createdAt,
@@ -3149,12 +3163,19 @@ function renderPrompt(b) {
3149
3163
  ] : [],
3150
3164
  subagent ? "## Then: install Armada and claim the ticket" : "## First: install Armada and claim the ticket",
3151
3165
  "",
3166
+ ...subagent ? [
3167
+ "Run install, login and claim first. Immediately after claim, run the final heartbeat line as a separate Bash tool call with `run_in_background: true`; keep that Bash owned by this subagent.",
3168
+ ""
3169
+ ] : [],
3152
3170
  "```sh",
3153
3171
  b.install,
3154
3172
  ...b.launch ? [b.launch.command] : [],
3155
3173
  b.claimCommand,
3174
+ `armada heartbeat --every 5m --ticket ${t.id} --handle ${subagent ? subagentName(t.id) : CONDUCTOR_HANDLE} --parent "$PPID"${subagent ? "" : " --background"}`,
3156
3175
  "```",
3157
3176
  "",
3177
+ subagent ? "Keep this Bash heartbeat in the subagent's background: it dies with the subagent, which is intended. Do not detach it from the subagent. If background processes are unavailable, report manually at least every 15 minutes." : "The heartbeat detaches from the short-lived command shell (a new process group, like nohup + setsid), keeps a PID file under ~/.config/armada/watch/, and stays alive between turns and while waiting for messages. Its parent is the persistent agent PID ($PPID in the command shell), never the shell PID ($$). If startup fails or the runtime cannot keep a background process, report manually at least every 15 minutes instead.",
3178
+ "",
3158
3179
  `${b.armadaVersion.pinned === b.armadaVersion.coordinator ? "This installs the coordinator's Armada version." : `This installs Armada ${b.armadaVersion.pinned}, the newest on npm (the coordinator runs ${b.armadaVersion.coordinator}, not published yet).`} If the global install is refused, use \`${b.fallback}\` wherever this brief or the skill says \`armada\`.`,
3159
3180
  ...b.launch ? [
3160
3181
  "",
@@ -3504,13 +3525,14 @@ function updateDotenv(text, updates) {
3504
3525
  ` : "";
3505
3526
  }
3506
3527
  // ../core/src/fleet-api.ts
3507
- var WORKER_FLEET_OPS = ["claim", "report", "ask", "release"];
3528
+ var WORKER_FLEET_OPS = ["claim", "report", "ask", "release", "heartbeat"];
3508
3529
  var FLEET_OPS = [
3509
3530
  ...WORKER_FLEET_OPS,
3510
3531
  "register",
3511
3532
  "coordinator",
3512
3533
  "request",
3513
3534
  "events/latest",
3535
+ "heartbeats/latest",
3514
3536
  "launches",
3515
3537
  "inbox",
3516
3538
  "inbox/item",
@@ -3536,6 +3558,8 @@ function fleetClient(o) {
3536
3558
  return;
3537
3559
  }),
3538
3560
  lastEventTimes: () => call("events/latest", {}),
3561
+ heartbeatTimes: () => call("heartbeats/latest", {}),
3562
+ heartbeat: (input) => call("heartbeat", input),
3539
3563
  pendingLaunches: () => call("launches", {}),
3540
3564
  claim: (c) => call("claim", c),
3541
3565
  report: (r) => call("report", r),
@@ -3813,6 +3837,34 @@ async function fetchCommit(opts) {
3813
3837
  return null;
3814
3838
  return { sha: c.oid, tree: c.tree.oid, parents: c.parents.nodes.map((p) => p.oid) };
3815
3839
  }
3840
+ // ../core/src/heartbeat.ts
3841
+ async function heartbeatLoop(options) {
3842
+ let claimedAt = null;
3843
+ let next = options.now().getTime();
3844
+ while (options.parentAlive()) {
3845
+ const remaining = next - options.now().getTime();
3846
+ if (remaining > 0) {
3847
+ await options.sleep(Math.min(1000, remaining));
3848
+ continue;
3849
+ }
3850
+ let result = null;
3851
+ try {
3852
+ result = await options.ping({ ticket: options.ticket, handle: options.handle, claimedAt });
3853
+ } catch (error) {
3854
+ if (error instanceof ArmadaApiError && error.status !== null && error.status >= 400 && error.status < 500 && error.status !== 429)
3855
+ return "session-ended";
3856
+ }
3857
+ if (result) {
3858
+ if (!result.active || !result.claimedAt)
3859
+ return "session-ended";
3860
+ if (!claimedAt && options.ready && !await options.ready(result))
3861
+ return "already-running";
3862
+ claimedAt = result.claimedAt;
3863
+ }
3864
+ next = options.now().getTime() + options.everyMs;
3865
+ }
3866
+ return "parent-exited";
3867
+ }
3816
3868
  // ../core/src/inbox.ts
3817
3869
  function questionBody(question, options = []) {
3818
3870
  const listed = options.map((o) => o.trim()).filter(Boolean);
@@ -3842,6 +3894,7 @@ async function checkInbox(fleet, o) {
3842
3894
  const query = {
3843
3895
  coordinator: o.coordinator ?? null,
3844
3896
  silentAfterMinutes: o.silentAfterMinutes,
3897
+ quietAfterMinutes: o.quietAfterMinutes,
3845
3898
  ...o.facts ? { facts: o.facts } : {},
3846
3899
  ...o.notStartedMinutes !== undefined ? { notStartedMinutes: o.notStartedMinutes } : {}
3847
3900
  };
@@ -4229,6 +4282,7 @@ async function watchInbox(fleet, o) {
4229
4282
  const query = {
4230
4283
  coordinator: o.coordinator,
4231
4284
  silentAfterMinutes: o.silentAfterMinutes,
4285
+ quietAfterMinutes: o.quietAfterMinutes,
4232
4286
  ...o.facts ? { facts: o.facts } : {},
4233
4287
  ...o.notStartedMinutes !== undefined ? { notStartedMinutes: o.notStartedMinutes } : {}
4234
4288
  };
@@ -5346,6 +5400,8 @@ Armada never calls a runtime. This guide tells a coordinator running inside Clau
5346
5400
 
5347
5401
  ## Launch
5348
5402
 
5403
+ The brief starts a heartbeat immediately after claim. Run the heartbeat command in the subagent's **background Bash** (\`run_in_background: true\`), with \`--parent "$PPID"\` and its claim's \`--handle\`; do not use \`--background\`, \`nohup\` or \`setsid\` here. A subagent's background Bash dies with the subagent, which is the intended behaviour: detaching it could falsely keep a finished subagent alive while the coordinator's process still runs. It also stops when Armada ends its session (release, merge, revoke). If a runtime cannot keep any background Bash, report the fallback on the ticket and keep today's manual reports at least every 15 minutes. Report actual progress at meaningful steps even when heartbeats run.
5404
+
5349
5405
  1. Pick a ready ticket from \`armada status\` that does not collide with work in flight.
5350
5406
  2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' \`when\` rules by most files/work and pass \`--profile <name> --reason "<why>"\`. Mixed front-end/back-end work: choose the larger part and say why. An optional \`armada brief ABC-12\` or \`--json\` preview is read-only: neither mints a token nor marks a worker in flight. The profile must have \`runtime = "claude-code"\` in \`armada.toml\`. The profile's effort is not applied by the Agent tool; a worker that needs a set effort goes to Conductor.
5351
5407
  3. **Make one brief call for the launch:** \`armada brief ABC-12 --prompt --profile-line\`, keeping the chosen \`--profile\` and \`--reason\` flags. Stdout is the exact worker prompt; stderr names the profile, agent, model, effort, runtime and reason, so no second brief is needed for the model. Resolve warnings before launching. If the choice is still needed, \`--prompt\` refuses without minting anything. **The launch message is that \`--prompt\` output, and only it**: the human view and \`--json\` carry no token. The token works once, within the hour; generate a fresh prompt if it has expired. If you cancel or launching the subagent fails, use \`armada launch revoke ABC-12\`. Add what only you know (the boundary with a parallel worker, a decision not yet on the ticket) at the end. Without a launch token, stderr says why: usually \`armada login\`, then generate a new prompt.
@@ -5439,12 +5495,12 @@ A subagent launched without \`isolation: "worktree"\` runs in your checkout. The
5439
5495
  `;
5440
5496
 
5441
5497
  // ../../skills/armada-runtime-conductor/SKILL.md
5442
- var SKILL_default3 = "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada never calls a runtime. This guide tells the coordinator how to launch, message, check and stop a worker with the `conductor` command line tool, and what to record in Armada afterwards. It was checked against `conductor` 0.89.x (the desktop app's CLI, macOS) and 0.1.x (the CLI inside a Conductor Cloud workspace, Linux); every command below works in both. `conductor --version` prints yours; if a flag is refused, compare with `conductor <command> --help`.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, which is not on PATH. `armada doctor` looks for it and prints the fix: a link from a directory already on PATH (`ln -s \"/Applications/Conductor.app/Contents/Resources/bin/conductor\" ~/.local/bin/conductor`), or a PATH line for your shell profile.\n- Always pass `--json` and read fields with `jq`. Exit codes: 0 ok, 1 runtime error, 2 usage error, 3 authentication, 4 server error.\n- On exit code 3, `conductor auth whoami` checks the token the CLI uses (it exits 0 when the token works). Do not rely on `conductor auth status`: it only looks for a macOS Keychain entry and fails on Linux (\"Keychain storage is only supported on macOS\"). In a Conductor Cloud workspace the CLI reads `CONDUCTOR_API_KEY` from the environment and needs no login; on a Mac, `conductor auth login` stores a token in the Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`; the worker's claim comment carries it, so `armada status` and the ticket always lead back to the session.\n- A worker needs no key in its workspace: the prompt of `armada brief` carries a one-time launch token, and the worker's first command exchanges it for a session limited to its ticket, through which Armada gives each command its keys. The token works once, within the hour, so a copy left in a transcript is useless once used.\n- Never type a secret value into a command, a file or a message: name the variable and let your shell expand it. The expanded value is still in the `conductor` process's arguments while it runs, so launch from a machine only you use.\n\n## Launch\n\n1. Pick a ready ticket from `armada status` that does not collide with work in flight.\n2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' `when` rules by most files/work. Mixed front-end/back-end work: choose the larger part and say why with `--profile <name> --reason \"<why>\"`. An optional `armada brief ABC-12` or `--json` preview helps resolve the choice and warnings, but is read-only: neither creates a launch token nor marks a worker in flight. If the choice is still needed, `--prompt` refuses before minting anything.\n3. **Make one brief call for the launch:** `--prompt --profile-line` writes only the worker prompt to stdout and the selected profile (agent, model, effort, fast mode, runtime and reason) to stderr. Read that line to configure Conductor; no second brief is needed for the profile. Keep any `--profile` and `--reason` flags on this call. Resolve warnings before launching. Never cut a launch message from the human view or `--json`: they carry no token. Write the prompt to a file only you can read, then add what only you know (the boundary with a parallel worker, a decision not yet on the ticket). The token works once, within the hour; if you cancel or the runtime launch fails, use `armada launch revoke ABC-12`. Generate a fresh prompt if its token has expired.\n\n```sh\n(umask 077; armada brief ABC-12 --prompt --profile-line > /tmp/abc-12-brief.md)\n```\n\n4. Create the workspace with every value from the profile. Never leave the agent, model or effort to Conductor's defaults. Add `--fast-mode` when the profile says fast mode. Run the whole block as one command: shell state does not carry over between separate calls.\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\nrm -f /tmp/abc-12-brief.md\njq -r '\"\\(.workspaceId)/\\(.sessionId)\"' /tmp/abc-12-launch.json\n```\n\nIf the prompt has no launch token, its stderr warning says why. Not signed in: `armada login` (a headless coordinator sets `ARMADA_API_KEY`), then generate a new prompt; `armada doctor` checks the sign-in. Only on an Armada that keeps no keys yet (no accounts or no vault), pass the keys the read-only brief's environment table marks `required`, from your shell or from Armada's credentials file (`in credentials file`: the `set -a` line loads it without printing it; drop it when every variable is set in your shell). The subshell keeps the keys out of the rest of your session. Without a launch token the worker is not signed in to Armada: its claims and reports reach Linear only, with a warning. When Conductor's organization environment still holds the keys, every workspace already has them: use the first block.\n\n```sh\n(\n set -a; . \"${XDG_CONFIG_HOME:-$HOME/.config}/armada/credentials\"; set +a\n [ -n \"$LINEAR_API_KEY\" ] || { echo \"LINEAR_API_KEY is missing\" >&2; exit 1; }\n conductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n --env LINEAR_API_KEY=\"$LINEAR_API_KEY\" \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\n)\nrm -f /tmp/abc-12-brief.md\n```\n\n- `--branch` is the base branch (the default branch). Conductor creates a branch named `conductor/<slug of --name>`; the brief tells the worker to rename it to the ticket's branch.\n- The output has `workspaceId`, `sessionId`, `deepLink` and `initialMessage` (`messageId`, `state: \"queued\"`). Keep the handle the `jq` line prints, and give the owner the `deepLink` when they want to watch.\n- Conductor sets `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` inside the workspace, and signs `gh` in for the worker's pushes. The brief's first commands install your Armada version (`npm install -g`), sign in with the launch token (`armada login --launch-token`) and claim the ticket. `--env` values are not shown back by `workspace get`.\n- Keys in Conductor's organization environment reach every workspace, workers included: once Armada keeps the organization's keys, they belong on Armada's Keys page, not there.\n- An unknown agent, model or effort fails the command. Check the ids with `conductor model` (each agent's models, efforts and defaults) and fix the profile in `armada.toml`.\n\n5. **Check the claim.** Within a few minutes, `armada status` lists the ticket in flight, phase `planning`, runtime `Conductor`, and the ticket's claim comment reads `session: <workspaceId>/<sessionId>` and `profile: <name>`. No claim after `[policy] not_started_minutes` (ten by default): `armada watch` and `armada inbox` show a `not-started` entry; status lists it under \"Pending launches\" with `armada launch revoke ABC-12`. It says whether the worker never used its launch token (it never reached its login line) or signed in and stopped before its claim. An unused token expired more than an hour ago produces one `not started (token expired)` inbox notice, then clears. Exchanged launches without a claim stop being followed after 24 hours and remain revocable. Read the transcript (Status section). A worker whose launch token was refused (already used, or more than an hour old) needs a new one: `armada brief ABC-12 --prompt --profile-line` again, and message it only the `armada login --launch-token …` line of the new `--prompt` output (Message section). A worker cut off from Armada was revoked (Organization > Workers says by whom) or left idle for three days: ask the owner before you give a revoked worker a new token. If the worker cannot claim for another reason, fix the cause and message it; as a last resort record the handle yourself with `armada claim ABC-12 --runtime conductor --handle <workspaceId>/<sessionId> --profile <name>`, adding the brief's `--reason` for an override.\n\n## Message\n\n```sh\nprintf '%s\\n' \"Plan approved. Go on.\" | conductor --json message create --session <sessionId> --message-file -\nconductor --json message create --session <sessionId> --message-file - < /tmp/abc-12-answer.md\n```\n\nThe output is `{\"messageId\": …, \"state\": \"sent\"}`. Exit code 0 means Conductor accepted the message, not that the worker read it: check that the session turns `working`, then read its reply in the transcript. Use it to deliver an answer, a plan approval, or a heads-up that the default branch moved. Then record it in Armada: `armada answer <item> \"<answer>\"` for a question from `armada inbox`, `armada answer --note ABC-12 \"<message>\"` for a message the worker did not ask for.\n\n## Status\n\n```sh\nconductor --json session status <sessionId>\n```\n\nThe output is `{\"workspaceId\", \"sessionId\", \"status\", \"updatedAt\"}`. For a worker:\n\n- `working`: a turn is running. A silent worker that is `working` is busy (a long build or test run): leave it, and read the transcript if it stays silent past twice `policy.silence_minutes`.\n- `idle`: no turn is running. The worker finished its turn: it handed back, it waits for an answer, or it stopped without finishing. If `armada status` does not show it `ready-to-merge`, `awaiting-approval` or `blocked`, it has stopped: read its last reply, then message it to go on, or release and relaunch the ticket.\n- `error`: the last turn failed (agent or provider failure). Read the transcript and message it to resume; if it fails again, cancel, archive, release and relaunch.\n- Right after launch the session is `idle` for a few seconds while the workspace is initializing and the first message is queued; it turns `working` when the agent starts.\n\nThe workspace itself: `conductor --json workspace status <workspaceId>` gives `status` `initializing`, `ready` or `archived`.\n\n**Read the transcript** to see what a worker did or said. Events come oldest first, 100 per page; `hasMore` tells when to fetch the next page with `--after` the last event id. Keep the last id you read and poll from it.\n\n```sh\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\njq -r '.hasMore, .data[-1].id' /tmp/abc-12-events.json\nconductor --json session message <sessionId> --after <lastEventId> --limit 100\n```\n\nThe second line prints whether more pages exist and the id to continue from. `.content.rawPayload` is the agent's own event format, so the filters depend on the worker's agent (the `agent` of its profile in `armada.toml`).\n\nA `claude` worker: each turn's final reply, then the commands and tools it ran.\n\n```sh\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload | \"error=\\(.is_error)\\n\\(.result)\"' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n```\n\nA `codex` worker: its events are `.content.rawPayload.event`, each item once as `item.started` and once as `item.completed`; read the completed ones. Its messages (`phase` is `commentary` along the way, `final_answer` at the end of a turn), then each command with its exit code, and its tool calls (Linear and other MCP servers).\n\n```sh\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"mcpToolCall\") | \"\\(.server) \\(.tool)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types, look at one event of the type you need, and adapt the filter.\n\n```sh\njq -r '.data[].content.rawPayload | .type // .event.type // \"(no payload)\"' /tmp/abc-12-events.json | sort | uniq -c\n```\n\n## Stop and archive\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\n- `session cancel` stops the running turn: `{\"status\", \"canceledQueuedMessages\"}`, and the session is `idle` within seconds. The workspace stays; a message starts a new turn. Use it on a worker that runs the wrong thing.\n- `workspace archive` answers `{\"status\": \"archived\"}`. Archive a worker's workspace after its pull request is merged, or after `armada release --ticket ABC-12 --reason \"<why>\"` for a worker that stops without handing back. The branch and the pull request stay on GitHub.\n- **Wait for `idle` before archiving.** A hand-back often arrives while the worker's session is still `working`: `armada report ready-to-merge` runs inside its last turn, which then writes its final reply. Archive only once `session status` answers `idle`. Poll it every 15 seconds; if it is still `working` after 10 minutes, cancel the turn and archive (the transcript keeps what it was doing). Run the whole block as one command; it can take up to 10 minutes, so run it in the background or give it a longer command timeout:\n\n```sh\nfor i in $(seq 40); do\n [ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] || break\n sleep 15\ndone\n[ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] && conductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n- After an archive, `session status` still answers `idle`; `workspace status` says `archived`.\n";
5498
+ var SKILL_default3 = "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada never calls a runtime. This guide tells the coordinator how to launch, message, check and stop a worker with the `conductor` command line tool, and what to record in Armada afterwards. It was checked against `conductor` 0.89.x (the desktop app's CLI, macOS) and 0.1.x (the CLI inside a Conductor Cloud workspace, Linux); every command below works in both. `conductor --version` prints yours; if a flag is refused, compare with `conductor <command> --help`.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, which is not on PATH. `armada doctor` looks for it and prints the fix: a link from a directory already on PATH (`ln -s \"/Applications/Conductor.app/Contents/Resources/bin/conductor\" ~/.local/bin/conductor`), or a PATH line for your shell profile.\n- Always pass `--json` and read fields with `jq`. Exit codes: 0 ok, 1 runtime error, 2 usage error, 3 authentication, 4 server error.\n- On exit code 3, `conductor auth whoami` checks the token the CLI uses (it exits 0 when the token works). Do not rely on `conductor auth status`: it only looks for a macOS Keychain entry and fails on Linux (\"Keychain storage is only supported on macOS\"). In a Conductor Cloud workspace the CLI reads `CONDUCTOR_API_KEY` from the environment and needs no login; on a Mac, `conductor auth login` stores a token in the Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`; the worker's claim comment carries it, so `armada status` and the ticket always lead back to the session.\n- A worker needs no key in its workspace: the prompt of `armada brief` carries a one-time launch token, and the worker's first command exchanges it for a session limited to its ticket, through which Armada gives each command its keys. The token works once, within the hour, so a copy left in a transcript is useless once used.\n- Never type a secret value into a command, a file or a message: name the variable and let your shell expand it. The expanded value is still in the `conductor` process's arguments while it runs, so launch from a machine only you use.\n\n## Launch\n\nThe brief starts `armada heartbeat --every 5m --parent \"$PPID\" --background` immediately after claim. It creates a detached process group (like `nohup` + `setsid`) with closed terminal streams and a PID file under `~/.config/armada/watch/`. Plain `&` and `nohup` alone can be killed by command-tool cleanup on Cloud; detached startup survives between turns and while waiting for a message. `$PPID` in the agent's command shell must be the persistent agent process, never `$$` (the shell). The heartbeat stops with that parent or when Armada ends the current session (release, merge, revoke). If startup fails or the runtime cannot retain any background process, fall back to manual reports at least every 15 minutes and record that fallback on the ticket. Reports remain progress dots, not liveness.\n\n1. Pick a ready ticket from `armada status` that does not collide with work in flight.\n2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' `when` rules by most files/work. Mixed front-end/back-end work: choose the larger part and say why with `--profile <name> --reason \"<why>\"`. An optional `armada brief ABC-12` or `--json` preview helps resolve the choice and warnings, but is read-only: neither creates a launch token nor marks a worker in flight. If the choice is still needed, `--prompt` refuses before minting anything.\n3. **Make one brief call for the launch:** `--prompt --profile-line` writes only the worker prompt to stdout and the selected profile (agent, model, effort, fast mode, runtime and reason) to stderr. Read that line to configure Conductor; no second brief is needed for the profile. Keep any `--profile` and `--reason` flags on this call. Resolve warnings before launching. Never cut a launch message from the human view or `--json`: they carry no token. Write the prompt to a file only you can read, then add what only you know (the boundary with a parallel worker, a decision not yet on the ticket). The token works once, within the hour; if you cancel or the runtime launch fails, use `armada launch revoke ABC-12`. Generate a fresh prompt if its token has expired.\n\n```sh\n(umask 077; armada brief ABC-12 --prompt --profile-line > /tmp/abc-12-brief.md)\n```\n\n4. Create the workspace with every value from the profile. Never leave the agent, model or effort to Conductor's defaults. Add `--fast-mode` when the profile says fast mode. Run the whole block as one command: shell state does not carry over between separate calls.\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\nrm -f /tmp/abc-12-brief.md\njq -r '\"\\(.workspaceId)/\\(.sessionId)\"' /tmp/abc-12-launch.json\n```\n\nIf the prompt has no launch token, its stderr warning says why. Not signed in: `armada login` (a headless coordinator sets `ARMADA_API_KEY`), then generate a new prompt; `armada doctor` checks the sign-in. Only on an Armada that keeps no keys yet (no accounts or no vault), pass the keys the read-only brief's environment table marks `required`, from your shell or from Armada's credentials file (`in credentials file`: the `set -a` line loads it without printing it; drop it when every variable is set in your shell). The subshell keeps the keys out of the rest of your session. Without a launch token the worker is not signed in to Armada: its claims and reports reach Linear only, with a warning. When Conductor's organization environment still holds the keys, every workspace already has them: use the first block.\n\n```sh\n(\n set -a; . \"${XDG_CONFIG_HOME:-$HOME/.config}/armada/credentials\"; set +a\n [ -n \"$LINEAR_API_KEY\" ] || { echo \"LINEAR_API_KEY is missing\" >&2; exit 1; }\n conductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n --env LINEAR_API_KEY=\"$LINEAR_API_KEY\" \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\n)\nrm -f /tmp/abc-12-brief.md\n```\n\n- `--branch` is the base branch (the default branch). Conductor creates a branch named `conductor/<slug of --name>`; the brief tells the worker to rename it to the ticket's branch.\n- The output has `workspaceId`, `sessionId`, `deepLink` and `initialMessage` (`messageId`, `state: \"queued\"`). Keep the handle the `jq` line prints, and give the owner the `deepLink` when they want to watch.\n- Conductor sets `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` inside the workspace, and signs `gh` in for the worker's pushes. The brief's first commands install your Armada version (`npm install -g`), sign in with the launch token (`armada login --launch-token`) and claim the ticket. `--env` values are not shown back by `workspace get`.\n- Keys in Conductor's organization environment reach every workspace, workers included: once Armada keeps the organization's keys, they belong on Armada's Keys page, not there.\n- An unknown agent, model or effort fails the command. Check the ids with `conductor model` (each agent's models, efforts and defaults) and fix the profile in `armada.toml`.\n\n5. **Check the claim.** Within a few minutes, `armada status` lists the ticket in flight, phase `planning`, runtime `Conductor`, and the ticket's claim comment reads `session: <workspaceId>/<sessionId>` and `profile: <name>`. No claim after `[policy] not_started_minutes` (ten by default): `armada watch` and `armada inbox` show a `not-started` entry; status lists it under \"Pending launches\" with `armada launch revoke ABC-12`. It says whether the worker never used its launch token (it never reached its login line) or signed in and stopped before its claim. An unused token expired more than an hour ago produces one `not started (token expired)` inbox notice, then clears. Exchanged launches without a claim stop being followed after 24 hours and remain revocable. Read the transcript (Status section). A worker whose launch token was refused (already used, or more than an hour old) needs a new one: `armada brief ABC-12 --prompt --profile-line` again, and message it only the `armada login --launch-token …` line of the new `--prompt` output (Message section). A worker cut off from Armada was revoked (Organization > Workers says by whom) or left idle for three days: ask the owner before you give a revoked worker a new token. If the worker cannot claim for another reason, fix the cause and message it; as a last resort record the handle yourself with `armada claim ABC-12 --runtime conductor --handle <workspaceId>/<sessionId> --profile <name>`, adding the brief's `--reason` for an override.\n\n## Message\n\n```sh\nprintf '%s\\n' \"Plan approved. Go on.\" | conductor --json message create --session <sessionId> --message-file -\nconductor --json message create --session <sessionId> --message-file - < /tmp/abc-12-answer.md\n```\n\nThe output is `{\"messageId\": …, \"state\": \"sent\"}`. Exit code 0 means Conductor accepted the message, not that the worker read it: check that the session turns `working`, then read its reply in the transcript. Use it to deliver an answer, a plan approval, or a heads-up that the default branch moved. Then record it in Armada: `armada answer <item> \"<answer>\"` for a question from `armada inbox`, `armada answer --note ABC-12 \"<message>\"` for a message the worker did not ask for.\n\n## Status\n\n```sh\nconductor --json session status <sessionId>\n```\n\nThe output is `{\"workspaceId\", \"sessionId\", \"status\", \"updatedAt\"}`. For a worker:\n\n- `working`: a turn is running. A silent worker that is `working` is busy (a long build or test run): leave it, and read the transcript if it stays silent past twice `policy.silence_minutes`.\n- `idle`: no turn is running. The worker finished its turn: it handed back, it waits for an answer, or it stopped without finishing. If `armada status` does not show it `ready-to-merge`, `awaiting-approval` or `blocked`, it has stopped: read its last reply, then message it to go on, or release and relaunch the ticket.\n- `error`: the last turn failed (agent or provider failure). Read the transcript and message it to resume; if it fails again, cancel, archive, release and relaunch.\n- Right after launch the session is `idle` for a few seconds while the workspace is initializing and the first message is queued; it turns `working` when the agent starts.\n\nThe workspace itself: `conductor --json workspace status <workspaceId>` gives `status` `initializing`, `ready` or `archived`.\n\n**Read the transcript** to see what a worker did or said. Events come oldest first, 100 per page; `hasMore` tells when to fetch the next page with `--after` the last event id. Keep the last id you read and poll from it.\n\n```sh\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\njq -r '.hasMore, .data[-1].id' /tmp/abc-12-events.json\nconductor --json session message <sessionId> --after <lastEventId> --limit 100\n```\n\nThe second line prints whether more pages exist and the id to continue from. `.content.rawPayload` is the agent's own event format, so the filters depend on the worker's agent (the `agent` of its profile in `armada.toml`).\n\nA `claude` worker: each turn's final reply, then the commands and tools it ran.\n\n```sh\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload | \"error=\\(.is_error)\\n\\(.result)\"' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n```\n\nA `codex` worker: its events are `.content.rawPayload.event`, each item once as `item.started` and once as `item.completed`; read the completed ones. Its messages (`phase` is `commentary` along the way, `final_answer` at the end of a turn), then each command with its exit code, and its tool calls (Linear and other MCP servers).\n\n```sh\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"mcpToolCall\") | \"\\(.server) \\(.tool)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types, look at one event of the type you need, and adapt the filter.\n\n```sh\njq -r '.data[].content.rawPayload | .type // .event.type // \"(no payload)\"' /tmp/abc-12-events.json | sort | uniq -c\n```\n\n## Stop and archive\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\n- `session cancel` stops the running turn: `{\"status\", \"canceledQueuedMessages\"}`, and the session is `idle` within seconds. The workspace stays; a message starts a new turn. Use it on a worker that runs the wrong thing.\n- `workspace archive` answers `{\"status\": \"archived\"}`. Archive a worker's workspace after its pull request is merged, or after `armada release --ticket ABC-12 --reason \"<why>\"` for a worker that stops without handing back. The branch and the pull request stay on GitHub.\n- **Wait for `idle` before archiving.** A hand-back often arrives while the worker's session is still `working`: `armada report ready-to-merge` runs inside its last turn, which then writes its final reply. Archive only once `session status` answers `idle`. Poll it every 15 seconds; if it is still `working` after 10 minutes, cancel the turn and archive (the transcript keeps what it was doing). Run the whole block as one command; it can take up to 10 minutes, so run it in the background or give it a longer command timeout:\n\n```sh\nfor i in $(seq 40); do\n [ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] || break\n sleep 15\ndone\n[ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] && conductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n- After an archive, `session status` still answers `idle`; `workspace status` says `archived`.\n";
5443
5499
 
5444
5500
  // ../../skills/armada-worker/SKILL.md
5445
5501
  var SKILL_default4 = `---
5446
5502
  name: armada-worker
5447
- description: Working one ticket as an Armada worker agent. Use when you were launched on a ticket by an Armada coordinator, or asked to claim, plan, implement and ship one ticket of a project that has an armada.toml. Covers the claim, the phase reports every 15 minutes, questions to the coordinator, the green pull request and the hand-back. A worker never merges.
5503
+ description: Working one ticket as an Armada worker agent. Use when you were launched on a ticket by an Armada coordinator, or asked to claim, plan, implement and ship one ticket of a project that has an armada.toml. Covers the claim, background liveness, progress reports, questions to the coordinator, the green pull request and the hand-back. A worker never merges.
5448
5504
  ---
5449
5505
 
5450
5506
  You are a worker. You own exactly one ticket, named in your launch brief. You turn it into one green pull request and hand it back to the coordinator, who merges. \`armada.toml\` at the repository root names the tracker program, the label groups and the policy; \`AGENTS.md\` (or \`CLAUDE.md\`) holds the repository's own rules, and they win over this skill where they are stricter.
@@ -5452,7 +5508,8 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
5452
5508
  ## Rules
5453
5509
 
5454
5510
  - **Never merge**, never enable auto-merge, never approve your own plan. The coordinator merges.
5455
- - **Report at least every 15 minutes** of work with \`armada report <phase> --message "<what you are doing>"\`. The same phase is allowed: it is your heartbeat. A worker silent for longer than \`policy.silence_minutes\` shows as silent, and the coordinator comes to check on you.
5511
+ - **Start the heartbeat right after claim**, using the line in your brief. It pings Armada only, never Linear. Conductor's \`--background\` detaches it and keeps a PID file: it survives between turns and while waiting for a message. Pass the persistent agent PID, \`$PPID\` in its command shell, not the short-lived shell \`$$\`. On Claude Code use the subagent's background Bash without \`--background\`: it dies with the subagent, as intended. If startup fails or the runtime cannot retain any background process, fall back to manual reports at least every 15 minutes and say so on the ticket. Older CLIs keep that manual rule too.
5512
+ - **Report at each real step** with \`armada report <phase> --message "<what changed, what is next>"\`: the plan, meaningful implementation progress, blockers, tests, shipping and hand-back. The same phase is allowed. Reports are progress, not liveness: \`policy.silence_minutes\` measures missing heartbeats (15 by default); \`policy.quiet_minutes\` is a coordinator-only reminder for a live worker without a report (45 by default). Never post empty reports just to look alive.
5456
5513
  - **Keep going on setup choices.** When setup needs a choice (an install fallback, a retry, a missing tool), pick the safe option, say which in your next report, and keep going: never stop to ask about it. Ask only for product decisions.
5457
5514
  - **Ask instead of guessing** when a choice changes the ticket's outcome: \`armada ask "<question and your recommendation>" --options "<a> | <b>"\`. Your phase becomes \`blocked\` and the question reaches the coordinator's inbox. Then **stop and end your turn**: the answer arrives as a message in this session, not in a command's output. When it arrives, report the phase you resume, for example \`armada report implementing --message "resumed: <the decision>"\`. Decide reversible technical choices yourself and record each one, with its reason, on the ticket and in the pull request.
5458
5515
  - **The ticket is the source of truth.** Read it, its parent spec and the hand-back comments of its merged blockers in full before planning.
@@ -5860,6 +5917,7 @@ function buildStatus({
5860
5917
  forge,
5861
5918
  forgeError = null,
5862
5919
  lastEvents,
5920
+ heartbeats,
5863
5921
  live,
5864
5922
  launches = [],
5865
5923
  extraWarnings = [],
@@ -5871,6 +5929,7 @@ function buildStatus({
5871
5929
  now: now.getTime(),
5872
5930
  silentAfterMinutes: config.policy.silentAfterMinutes,
5873
5931
  ...lastEvents ? { lastEvents } : {},
5932
+ ...heartbeats ? { heartbeats } : {},
5874
5933
  ...live ? { live } : {}
5875
5934
  });
5876
5935
  const phaseOf = new Map(lanes.map((l) => [l.issue.id, l.phase]));
@@ -5920,6 +5979,7 @@ function buildStatus({
5920
5979
  since: l.since,
5921
5980
  lastUpdate: l.lastUpdate,
5922
5981
  lastReport: l.lastReport,
5982
+ lastHeartbeat: l.lastHeartbeat,
5923
5983
  silent: l.flags.includes("silent"),
5924
5984
  statusLine: l.statusLine ? { summary: l.statusLine.summary, at: l.statusLine.at, url: l.statusLine.url, plan: l.statusLine.plan } : null,
5925
5985
  pr: l.pr ? prRef(l.pr) : null,
@@ -5983,10 +6043,13 @@ async function loadStatus(config, opts) {
5983
6043
  const launchesP = opts.launches ? opts.launches().then((launches) => ({ launches }), (err) => ({
5984
6044
  warning: `Armada's launches could not be read (${err instanceof Error ? err.message : String(err)}); workers launched that never started are not listed`
5985
6045
  })) : Promise.resolve({});
5986
- const [{ program, forge, forgeError }, events, launches] = await Promise.all([
6046
+ const [{ program, forge, forgeError }, events, launches, heartbeats] = await Promise.all([
5987
6047
  readStatusSources(config, opts),
5988
6048
  eventsP,
5989
- launchesP
6049
+ launchesP,
6050
+ opts.heartbeats?.().catch(() => {
6051
+ return;
6052
+ })
5990
6053
  ]);
5991
6054
  return buildStatus({
5992
6055
  config,
@@ -5994,13 +6057,14 @@ async function loadStatus(config, opts) {
5994
6057
  forge,
5995
6058
  forgeError,
5996
6059
  ...events.events ? { lastEvents: events.events } : {},
6060
+ ...heartbeats ? { heartbeats } : {},
5997
6061
  ...launches.launches ? { launches: launches.launches } : {},
5998
6062
  extraWarnings: [events.warning, launches.warning].filter((w) => !!w),
5999
6063
  now: now()
6000
6064
  });
6001
6065
  }
6002
6066
  // package.json
6003
- var version = "0.2.19";
6067
+ var version = "0.2.20";
6004
6068
 
6005
6069
  // src/attach.ts
6006
6070
  import { resolve } from "node:path";
@@ -6557,7 +6621,11 @@ function liveFleet(io, config, credentials) {
6557
6621
  }
6558
6622
  function statusLive(io, config, credentials) {
6559
6623
  const { fleet } = liveFleet(io, config, credentials);
6560
- return fleet ? { lastEvents: () => fleet.lastEventTimes(), launches: () => fleet.pendingLaunches() } : undefined;
6624
+ return fleet ? {
6625
+ lastEvents: () => fleet.lastEventTimes(),
6626
+ heartbeats: () => fleet.heartbeatTimes(),
6627
+ launches: () => fleet.pendingLaunches()
6628
+ } : undefined;
6561
6629
  }
6562
6630
  function currentTicket(io, config, explicit, workers = []) {
6563
6631
  const fromEnv = io.env.ARMADA_TICKET?.trim();
@@ -6843,6 +6911,7 @@ async function inbox2(io, config, credentials, a) {
6843
6911
  coordinator: coordinatorHandle(io),
6844
6912
  facts: detectCoordinator(io),
6845
6913
  silentAfterMinutes: config.policy.silentAfterMinutes,
6914
+ quietAfterMinutes: config.policy.quietAfterMinutes,
6846
6915
  notStartedMinutes: config.policy.notStartedMinutes,
6847
6916
  now: io.now ?? (() => new Date),
6848
6917
  ...wait ? { wait: { timeoutMs, sleep: io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))) } } : {}
@@ -6972,6 +7041,7 @@ async function watchUntil(io, config, credentials, json, configPath) {
6972
7041
  coordinator: coordinatorHandle(io),
6973
7042
  facts: detectCoordinator(io),
6974
7043
  silentAfterMinutes: config.policy.silentAfterMinutes,
7044
+ quietAfterMinutes: config.policy.quietAfterMinutes,
6975
7045
  notStartedMinutes: config.policy.notStartedMinutes,
6976
7046
  seen: before?.seen ?? [],
6977
7047
  now: io.now ?? (() => new Date),
@@ -7545,6 +7615,93 @@ async function doctor(io, json, armadaVersion) {
7545
7615
  return report.errors ? 1 : 0;
7546
7616
  }
7547
7617
 
7618
+ // src/heartbeat.ts
7619
+ import { createHash as createHash3 } from "node:crypto";
7620
+ async function heartbeat2(io, config, credentials, args) {
7621
+ if (args.rest.length)
7622
+ throw new UsageError("heartbeat takes no positional argument");
7623
+ const interval = args.options.every ?? "5m";
7624
+ const match = interval.match(/^(\d+(?:\.\d+)?)(s|m)$/);
7625
+ const everyMs = match ? Number(match[1]) * (match[2] === "m" ? 60000 : 1000) : 0;
7626
+ if (!Number.isFinite(everyMs) || everyMs < 1000 || everyMs > config.policy.silentAfterMinutes * 60000)
7627
+ throw new UsageError("--every needs seconds or minutes, at least 1s and no longer than policy.silence_minutes");
7628
+ const parent = Number(args.options.parent);
7629
+ if (!Number.isSafeInteger(parent) || parent <= 1)
7630
+ throw new UsageError('--parent needs the persistent agent PID (pass --parent "$PPID" from its command shell)');
7631
+ const ticket = currentTicket(io, config, args.options.ticket, credentials.armadaSignIn?.kind === "worker" ? [credentials.armadaSignIn.ticket] : []);
7632
+ const handle = args.options.handle || (io.env.CONDUCTOR_WORKSPACE_ID && io.env.CONDUCTOR_SESSION_ID ? `${io.env.CONDUCTOR_WORKSPACE_ID}/${io.env.CONDUCTOR_SESSION_ID}` : null);
7633
+ if (!handle)
7634
+ throw new UsageError("heartbeat needs --handle <claim-handle> outside Conductor");
7635
+ const alive = () => !io.stopped?.() && (io.processAlive ?? processAlive)(parent);
7636
+ if (!alive())
7637
+ throw new UsageError("the heartbeat parent no longer runs");
7638
+ const { fleet } = liveFleet(io, config, credentials);
7639
+ if (!fleet)
7640
+ throw new UsageError("heartbeat needs an Armada sign-in; use manual reports at least every 15 minutes");
7641
+ if (args.options.background === "true") {
7642
+ let started = false;
7643
+ try {
7644
+ started = await io.startBackground?.([
7645
+ "heartbeat",
7646
+ "--ticket",
7647
+ ticket,
7648
+ "--handle",
7649
+ handle,
7650
+ "--every",
7651
+ interval,
7652
+ "--parent",
7653
+ String(parent),
7654
+ ...args.config ? ["--config", args.config] : []
7655
+ ]) ?? false;
7656
+ } catch {}
7657
+ if (!started) {
7658
+ io.stderr(`armada: background heartbeat unavailable; report manually at least every 15 minutes.
7659
+ `);
7660
+ return 1;
7661
+ }
7662
+ io.stdout(`Heartbeat running in the background for ${ticket} (every ${interval}, parent ${parent}).
7663
+ `);
7664
+ return 0;
7665
+ }
7666
+ const paths = machinePaths(io.env);
7667
+ if (!paths)
7668
+ throw new UsageError("heartbeat needs HOME or XDG_CONFIG_HOME for its PID file");
7669
+ const pid = io.pid ?? process.pid;
7670
+ let lock = null;
7671
+ let ready = false;
7672
+ try {
7673
+ const result = await heartbeatLoop({
7674
+ ticket,
7675
+ handle,
7676
+ everyMs,
7677
+ now: io.now ?? (() => new Date),
7678
+ sleep: io.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))),
7679
+ parentAlive: alive,
7680
+ ping: (input) => fleet.heartbeat(input),
7681
+ ready: async (session) => {
7682
+ const name = `${config.project.slug}-heartbeat-${ticket.toLowerCase()}-${createHash3("sha256").update(`${handle}/${session.claimedAt}`).digest("hex").slice(0, 12)}`;
7683
+ const acquired = await takeWatchLock(paths, name, pid, io.processAlive ?? processAlive);
7684
+ if (acquired.taken)
7685
+ lock = name;
7686
+ ready = true;
7687
+ io.backgroundReady?.(true);
7688
+ return acquired.taken;
7689
+ }
7690
+ });
7691
+ if (!ready)
7692
+ io.backgroundReady?.(false);
7693
+ return result === "session-ended" && !ready ? 1 : 0;
7694
+ } catch {
7695
+ io.backgroundReady?.(false);
7696
+ io.stderr(`armada: heartbeat unavailable; report manually at least every 15 minutes.
7697
+ `);
7698
+ return 1;
7699
+ } finally {
7700
+ if (lock)
7701
+ await releaseWatchLock(paths, lock, pid);
7702
+ }
7703
+ }
7704
+
7548
7705
  // src/init.ts
7549
7706
  import { mkdtemp, realpath, rm as rm3 } from "node:fs/promises";
7550
7707
  import { tmpdir } from "node:os";
@@ -8409,6 +8566,11 @@ var COMMAND_HELP = {
8409
8566
  Privately attach PNG, JPEG, WebP or GIF images (up to 2 MB each),
8410
8567
  or HTTPS links. Prints a dashboard URL for each attachment.
8411
8568
  --for keeps a free reference for an owner validation item
8569
+ `,
8570
+ heartbeat: ` heartbeat --every 5m --parent <agent-pid> [--background] [--ticket <id>] [--handle <id>]
8571
+ Keep the current worker session alive through Armada only, with no
8572
+ Linear comment. Stops with the parent or the released/revoked session.
8573
+ --background detaches from the command shell and keeps a PID file
8412
8574
  `,
8413
8575
  status: ` status Tickets in flight, tickets ready to start and pull requests waiting
8414
8576
  status --all The same for every project registered by \`armada init\`
@@ -8615,6 +8777,8 @@ Options:
8615
8777
  ${options.join("")}`;
8616
8778
  }
8617
8779
  var VALUE_OPTIONS = [
8780
+ "every",
8781
+ "parent",
8618
8782
  "runtime",
8619
8783
  "handle",
8620
8784
  "branch",
@@ -8641,6 +8805,7 @@ var VALUE_OPTIONS = [
8641
8805
  "for"
8642
8806
  ];
8643
8807
  var FLAG_OPTIONS = [
8808
+ "background",
8644
8809
  "dry-run",
8645
8810
  "no-lock",
8646
8811
  "no-ticket",
@@ -8655,6 +8820,7 @@ var FLAG_OPTIONS = [
8655
8820
  ];
8656
8821
  var COMMAND_OPTIONS = {
8657
8822
  attach: ["caption", "for"],
8823
+ heartbeat: ["every", "parent", "background", "ticket", "handle"],
8658
8824
  claim: ["runtime", "handle", "branch", "profile", "reason"],
8659
8825
  report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha"],
8660
8826
  release: ["ticket", "reason"],
@@ -8845,6 +9011,19 @@ async function dispatch(argv, io) {
8845
9011
  });
8846
9012
  return await attachCommand(io, config, credentials, args);
8847
9013
  }
9014
+ if (args.command === "heartbeat") {
9015
+ const { path, text } = await findConfig(io, args.config, "heartbeat");
9016
+ const config = parseConfig(text, path);
9017
+ const { credentials } = await loadCredentials(io, {
9018
+ armada: false,
9019
+ worker: {
9020
+ command: "heartbeat",
9021
+ project: config.project.slug,
9022
+ ticket: (stored) => currentTicket(io, config, args.options.ticket, stored)
9023
+ }
9024
+ });
9025
+ return await heartbeat2(io, config, credentials, args);
9026
+ }
8848
9027
  const worker = { claim, report, release, ask, inbox: inbox2, answer }[args.command];
8849
9028
  if (worker) {
8850
9029
  const { path, text } = await findConfig(io, args.config, args.command);
@@ -9002,6 +9181,33 @@ var spawnInherited = (command, args, { cwd, env }) => new Promise((done, fail) =
9002
9181
  done(code ?? 128 + (signal ? constants.signals[signal] ?? 0 : 0));
9003
9182
  });
9004
9183
  });
9184
+ var startBackground = (args) => new Promise((resolve) => {
9185
+ if (process.platform === "win32")
9186
+ return resolve(false);
9187
+ const child = spawn(process.execPath, [...process.execArgv, process.argv[1], ...args], {
9188
+ cwd: process.cwd(),
9189
+ env: process.env,
9190
+ detached: true,
9191
+ stdio: ["ignore", "ignore", "ignore", "ipc"]
9192
+ });
9193
+ let settled = false;
9194
+ const finish = (ready) => {
9195
+ if (settled)
9196
+ return;
9197
+ settled = true;
9198
+ clearTimeout(timeout);
9199
+ if (!ready)
9200
+ child.kill("SIGTERM");
9201
+ if (child.connected)
9202
+ child.disconnect();
9203
+ child.unref();
9204
+ resolve(ready);
9205
+ };
9206
+ const timeout = setTimeout(() => finish(false), 20000);
9207
+ child.once("error", () => finish(false));
9208
+ child.once("exit", () => finish(false));
9209
+ child.once("message", (message) => finish(typeof message === "object" && message !== null && "ready" in message && message.ready === true));
9210
+ });
9005
9211
 
9006
9212
  // src/main.ts
9007
9213
  function gitBranch() {
@@ -9081,6 +9287,12 @@ var exec = (command, args, { cwd }) => new Promise((done, fail) => {
9081
9287
  child.on("error", fail);
9082
9288
  child.on("close", (code) => done({ code: code ?? 1, stdout, stderr }));
9083
9289
  });
9290
+ var stopped = false;
9291
+ if (process.argv.includes("heartbeat") && !process.argv.includes("--background"))
9292
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"])
9293
+ process.on(signal, () => {
9294
+ stopped = true;
9295
+ });
9084
9296
  var code = await run(process.argv.slice(2), {
9085
9297
  machineName: hostname2(),
9086
9298
  ttyName: process.stdin.isTTY ? spawnSync("tty", [], { encoding: "utf8", stdio: ["inherit", "pipe", "ignore"] }).stdout?.trim() || null : null,
@@ -9129,6 +9341,14 @@ var code = await run(process.argv.slice(2), {
9129
9341
  readStdin,
9130
9342
  exec,
9131
9343
  spawn: spawnInherited,
9344
+ startBackground,
9345
+ stopped: () => stopped,
9346
+ backgroundReady: (ready) => {
9347
+ if (process.connected)
9348
+ process.send?.({ ready });
9349
+ },
9132
9350
  openUrl
9133
9351
  });
9134
9352
  process.exitCode = code;
9353
+ if (process.connected)
9354
+ process.disconnect?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",