fleet: Claude Code resident runtime (web lead on Claude), ios served, resident workspaces, HQ self-heal #162

Merged
founder merged 3 commits from fleet/claude-runtime into main 2026-08-22 03:52:52 +00:00
Owner

Founder ask (2026-08-19): migrate the work to resident codexes + claudes — web engineer on Claude, the rest on Codex — all running and responsive on Zulip, ready to take delegated work and put up first PRs; goal: a self-sustaining agent ecology.

What this PR does

Claude Code resident runtime (dispatch pin d044fca5, dispatch PR key-store/dispatch#3): the supervisor gains a second runtime. Roles whose org agent.runtime resolves to claude run Claude Code headless (claude -p --input-format stream-json --output-format stream-json): one long-lived process per identity thread bound to a stable --session-id (resumed after a crash), --append-system-prompt for the identity instructions, --effort from the role, the forge control-plane MCP hub via --mcp-config (bearer expanded from the task env — verified forge_control_plane=connected, zulip_current_user → web@key.store), acceptEdits + explicit tool allow list (bypassPermissions is refused as root). Steers written mid-turn are injected into the running turn (verified on 2.1.148: one result per turn) so steer/turn bookkeeping is unchanged; crash/overload turns are requeued. Zulip steers can be pinned to an identity by the invoked bot's bot_email.

  • org/organization.toml: agent_runtime.default_runtime = "codex", tier claude-high (claude-opus-5 / high), tech_lead_web → claude-high. Tier/default models only apply to roles of the same runtime (a claude role never inherits a gpt id).
  • nixos/modules/services/agent-dispatcher: services."key.store".agentDispatcher.claude.{path,configDir,anthropicApiKeyFile,steering} → supervisor flags/env, per-identity CLAUDE_CONFIG_DIR root, ReadWrite/ReadOnly paths; supervisor Restart=always.
  • forge: pkgs.claude-code (unfree predicate), agentDispatcher.claude wired, OpenBao entry anthropicApiKey = runtime "anthropic/api-key" materialised for the supervisor (the .age file is not read); ios is no longer excluded from the forge supervisor (it had no host at all).
  • Resident workspaces (key-store-resident-workspaces, oneshot before the supervisor): each identity thread's cwd becomes a git checkout of key.store, user.name/email = the identity, a credential helper that reads the identity's Forgejo token file at push time, and an SSH signing key minted on the forge (published under /var/lib/key-store/resident-signers/allowed_signers, not auto-trusted — see decision 1).
  • HQ: the dispatcher API/supervisor no longer Requires= the forge Postgres tunnel (a tunnel restart took them down and left them dead 2026-08-17 → the assistant was silent for two days; I restarted it by hand today); Restart=always + the tunnel Upholds= them.
  • docs/agents/resident-runtimes.md: runtimes, placement, how to delegate from Zulip, health checks.

Verified: nix eval of forge + HQ toplevels; full forge closure builds on the forge (nixos-system-keystore-forge-26.05.20260819.…); dispatch go test ./... -race green.

Founder decisions needed (blocked for me by the permission classifier — all security-relevant, rightly)

  1. Trust resident signing keys so agent PRs can merge (main's pre-receive hook rejects untrusted signatures): after the switch, cat /var/lib/key-store/resident-signers/allowed_signers → paste the pubkeys into contributors.nix + make contributors (canonical KSE-0001), or have forgejo-ssh-signing append that file to /var/lib/forgejo/.git_allowed_signers. Alternative: point user.signingkey in the workspaces at /root/.ssh/forge-ed25519 (already trusted; commits still authored as the identity).
  2. Zulip per-identity bots: convert web@key.store … (all identity accounts except founder) to outgoing-webhook bots pointed at https://dispatch.key.store/webhook/zulip (same shape as the existing agent-dispatcher-bot, bot_type=3 + zerver_service row with the dispatcher token, then scripts/setup/flush-memcached) so @**Web** … and DMs route directly. Until then: @**Agent Dispatcher** @web ….
  3. Forgejo write access + main protection: give the identities push rights on branches (org team with write on key.store) and turn on the push/merge whitelist for main (founder, forge, runner, release-runner) so residents can only land work through reviewed PRs.
  4. Merge dispatch PR #3 (fast-forward; the pin here already points at its commit) and this PR; then a forge switch (deploy-forge-host or /root/switch.sh).

🤖 Generated with Claude Code

Founder ask (2026-08-19): migrate the work to resident codexes + claudes — web engineer on Claude, the rest on Codex — all running and responsive on Zulip, ready to take delegated work and put up first PRs; goal: a self-sustaining agent ecology. ## What this PR does **Claude Code resident runtime** (dispatch pin `d044fca5`, dispatch PR key-store/dispatch#3): the supervisor gains a second runtime. Roles whose org `agent.runtime` resolves to `claude` run Claude Code headless (`claude -p --input-format stream-json --output-format stream-json`): one long-lived process per identity thread bound to a stable `--session-id` (resumed after a crash), `--append-system-prompt` for the identity instructions, `--effort` from the role, the forge control-plane MCP hub via `--mcp-config` (bearer expanded from the task env — verified `forge_control_plane=connected`, `zulip_current_user` → `web@key.store`), `acceptEdits` + explicit tool allow list (bypassPermissions is refused as root). Steers written mid-turn are injected into the running turn (verified on 2.1.148: one `result` per turn) so steer/turn bookkeeping is unchanged; crash/overload turns are requeued. Zulip steers can be pinned to an identity by the invoked bot's `bot_email`. - `org/organization.toml`: `agent_runtime.default_runtime = "codex"`, tier `claude-high` (claude-opus-5 / high), `tech_lead_web` → `claude-high`. Tier/default models only apply to roles of the same runtime (a claude role never inherits a gpt id). - `nixos/modules/services/agent-dispatcher`: `services."key.store".agentDispatcher.claude.{path,configDir,anthropicApiKeyFile,steering}` → supervisor flags/env, per-identity `CLAUDE_CONFIG_DIR` root, ReadWrite/ReadOnly paths; supervisor `Restart=always`. - forge: `pkgs.claude-code` (unfree predicate), `agentDispatcher.claude` wired, **OpenBao** entry `anthropicApiKey = runtime "anthropic/api-key"` materialised for the supervisor (the .age file is not read); **`ios` is no longer excluded** from the forge supervisor (it had no host at all). - **Resident workspaces** (`key-store-resident-workspaces`, oneshot before the supervisor): each identity thread's cwd becomes a git checkout of key.store, `user.name/email` = the identity, a credential helper that reads the identity's Forgejo token file at push time, and an SSH signing key minted on the forge (published under `/var/lib/key-store/resident-signers/allowed_signers`, **not** auto-trusted — see decision 1). - HQ: the dispatcher API/supervisor no longer `Requires=` the forge Postgres tunnel (a tunnel restart took them down and left them dead 2026-08-17 → the assistant was silent for two days; I restarted it by hand today); `Restart=always` + the tunnel `Upholds=` them. - `docs/agents/resident-runtimes.md`: runtimes, placement, how to delegate from Zulip, health checks. Verified: `nix eval` of forge + HQ toplevels; full forge closure builds on the forge (`nixos-system-keystore-forge-26.05.20260819.…`); dispatch `go test ./... -race` green. ## Founder decisions needed (blocked for me by the permission classifier — all security-relevant, rightly) 1. **Trust resident signing keys** so agent PRs can merge (main's pre-receive hook rejects untrusted signatures): after the switch, `cat /var/lib/key-store/resident-signers/allowed_signers` → paste the pubkeys into `contributors.nix` + `make contributors` (canonical KSE-0001), *or* have `forgejo-ssh-signing` append that file to `/var/lib/forgejo/.git_allowed_signers`. Alternative: point `user.signingkey` in the workspaces at `/root/.ssh/forge-ed25519` (already trusted; commits still authored as the identity). 2. **Zulip per-identity bots**: convert `web@key.store` … (all identity accounts except founder) to outgoing-webhook bots pointed at `https://dispatch.key.store/webhook/zulip` (same shape as the existing `agent-dispatcher-bot`, `bot_type=3` + `zerver_service` row with the dispatcher token, then `scripts/setup/flush-memcached`) so `@**Web** …` and DMs route directly. Until then: `@**Agent Dispatcher** @web …`. 3. **Forgejo write access + main protection**: give the identities push rights on branches (org team with write on key.store) and turn on the push/merge whitelist for `main` (founder, forge, runner, release-runner) so residents can only land work through reviewed PRs. 4. Merge dispatch PR #3 (fast-forward; the pin here already points at its commit) and this PR; then a forge switch (deploy-forge-host or `/root/switch.sh`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- dispatch pin d044fca5: the supervisor grows a second resident runtime.
  Roles whose org agent.runtime resolves to "claude" run Claude Code headless
  (stream-json, one long-lived process per identity thread with a stable
  session id, --append-system-prompt instructions, --effort from the role,
  the control-plane MCP hub via --mcp-config, acceptEdits + explicit tool
  allow list, mid-turn steers injected into the running turn). Zulip steers
  can be pinned to an identity by the invoked bot's email.
- org/organization.toml: agent_runtime.default_runtime = "codex"; new tier
  claude-high (claude-opus-5 / high); tech_lead_web moves to it (founder:
  "web engineer claude-based, the rest codex").
- nixos/modules/services/agent-dispatcher: services."key.store".agentDispatcher
  .claude.{path,configDir,anthropicApiKeyFile,steering} -> supervisor flags/env,
  tmpfiles + ReadWritePaths for the per-identity CLAUDE_CONFIG_DIR root, the key
  file on ReadOnlyPaths; supervisor Restart=always.
- forge: pkgs.claude-code (unfree predicate), agentDispatcher.claude wired,
  OpenBao entry anthropicApiKey = age/anthropic/api-key materialised for the
  supervisor (no age file read); ios no longer excluded from the forge
  supervisor (it had no host at all).
- HQ: the dispatcher API/supervisor no longer Requires= the forge Postgres
  tunnel (a tunnel restart used to take them down and leave them dead —
  2026-08-17); Restart=always + the tunnel Upholds= them.
- docs/agents/resident-runtimes.md: runtimes, placement, how to delegate from
  Zulip, health checks.
forge: provision resident identity workspaces (clones, identity git config, push credential, signing keys)
All checks were successful
Build: Web / Build (Web) (pull_request) Successful in 37s
Build: KaiOS / Build (KaiOS) (pull_request) Successful in 1m38s
Build: Linux / Build (Linux x86_64) (pull_request) Successful in 4m23s
Build: Linux / Build (keystore-forge x86_64) (pull_request) Has been skipped
Build: Apple / Check (SwiftLint) (pull_request) Successful in 3m10s
Build: Apple / Build (visionOS) (pull_request) Successful in 57s
Build: Apple / Build (iOS) (pull_request) Successful in 4m12s
Build: Apple / Build (macOS) (pull_request) Successful in 5m7s
a8a8821dbc
Every identity thread's cwd becomes a git checkout of key.store owned by that
identity: key-store-resident-workspaces (oneshot, before the supervisor) clones
the repo per (role, identity) work root — the same layout the dispatch
supervisor uses — sets user.name/email to the identity, a credential helper
that reads the identity's Forgejo token file at push time, and an SSH signing
key minted on the forge (published under /var/lib/key-store/resident-signers,
NOT added to Forgejo's allowed signers: trusting resident keys is a KSE-0001
decision for the founder — contributors.nix, or merge the runtime file).
founder force-pushed fleet/claude-runtime from a8a8821dbc
All checks were successful
Build: Web / Build (Web) (pull_request) Successful in 37s
Build: KaiOS / Build (KaiOS) (pull_request) Successful in 1m38s
Build: Linux / Build (Linux x86_64) (pull_request) Successful in 4m23s
Build: Linux / Build (keystore-forge x86_64) (pull_request) Has been skipped
Build: Apple / Check (SwiftLint) (pull_request) Successful in 3m10s
Build: Apple / Build (visionOS) (pull_request) Successful in 57s
Build: Apple / Build (iOS) (pull_request) Successful in 4m12s
Build: Apple / Build (macOS) (pull_request) Successful in 5m7s
to 1d3d46e985
All checks were successful
Build: KaiOS / Build (KaiOS) (pull_request) Successful in 33s
Build: Web / Build (Web) (pull_request) Successful in 34s
Namespace: Build Images / Refresh macOS runner lane (push) Successful in 4s
Release: If Needed / Check (Release Needed) (push) Successful in 5s
Build: KaiOS / Build (KaiOS) (push) Successful in 23s
Build: Web / Build (Web) (push) Successful in 32s
Namespace: Build Images / Refresh Linux runner image (push) Successful in 1m1s
Release: Signing Preflight / Release (Signing Preflight) (push) Successful in 1m9s
Deploy: Web / Deploy (Web) (push) Successful in 2m40s
Deploy: API / Deploy (API) (push) Successful in 2m55s
Build: Linux / Build (Linux x86_64) (pull_request) Successful in 3m50s
Build: Linux / Build (keystore-forge x86_64) (pull_request) Has been skipped
Build: Linux / Build (Linux x86_64) (push) Successful in 3m52s
Build: Linux / Build (keystore-forge x86_64) (push) Has been skipped
Build: Apple / Check (SwiftLint) (pull_request) Successful in 5m4s
Namespace: Build Images / Refresh macOS Nix snapshot application (push) Successful in 3m42s
Build: Apple / Build (visionOS) (pull_request) Successful in 33s
Build: Apple / Check (SwiftLint) (push) Successful in 5m1s
Build: Apple / Build (macOS) (pull_request) Successful in 2m43s
Build: Apple / Build (iOS) (push) Successful in 37s
Build: Apple / Build (iOS) (pull_request) Successful in 3m36s
Build: Apple / Build (macOS) (push) Successful in 3m4s
Build: Apple / Build (visionOS) (push) Successful in 3m31s
2026-08-22 03:51:59 +00:00
Compare
founder deleted branch fleet/claude-runtime 2026-08-22 03:52:53 +00:00
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
key-store/key.store!162
No description provided.