Three defects that all showed up as "the dashboard's numbers are wrong", plus the notification and brand work asked for alongside them. Tokens: Claude Code writes ONE JSONL line per content block of an assistant message, and every one of those lines repeats the same message-level `usage`. Both parsers summed them, so a tool-heavy session's tokens — and its cost — ran 1.5-2x high (one 4h session: $45.82 stored against $27.72 real). `lastUsageMsgId` counts a message once, carried across the transcript cache's incremental chunk boundaries. `replaceTokenUsage`'s high-water baselines mean the fixed parser cannot correct what is already stored, so `setTokenUsage` (exact, baselines cleared) is added for the deliberate re-parse path and `reconcileTokens` now covers every session with a transcript on disk rather than imported ones only. Turns: every `TurnDuration` row was stamped NOW while its dedup guard matched on the transcript's timestamp, so each hook re-inserted the session's whole turn history — 587k rows, 75% of a real events table, one session holding 68,747 copies of the same turns. The row now carries the transcript timestamp, which fixes the guard and the feed's ordering together. Same class of bug in the session metadata: `thinking_blocks` / `turn_count` / `total_turn_duration_ms` are assigned from the full parse instead of `+=`, since `extract()` returns whole-transcript totals on every call. Events: leftover checkout hook entries in `~/.claude/settings.json` double every event, every subagent row and every token figure. `stripLegacyHooks` has always removed them — but only inside `bootstrap()`, which `fastPathOk` skips on exactly the healthy installs where nothing else forces a full pass, so they survived indefinitely. `hasLegacyHooks` (pure fs) now blocks the fast path. A one-time repair at the first start after upgrading (`user_version` 3) deletes the duplicated `TurnDuration` rows and re-parses every transcript with exact writes. Marker 3 and not 2: an install that ran the earlier pass had its corrected rows re-inflated by whatever old build was still ingesting hooks. Router: switching a lane's AI Router while a pane is live only half-applies — Claude Code re-applies `env` to a running session but keeps the model it resolved at startup, so the old router's model name reaches the new endpoint and the next prompt fails with "model not found". The apply route reports `restart_required` / `run_id`, and the picker offers a Restart that respawns the pane from the lane id alone (replaying the old `--model` would re-create the mismatch). Notifications (#29): the two moments Claude is BLOCKED on the user now have their own switches and default to on — `onAwaitingInput` (a permission prompt or a question) and `onTurnComplete` (end of turn). Before, the first was unswitchable and the second hung off a preference that defaults to off, so the one thing a user walks away from went unannounced. Prefs shape/defaults/storage move to `client/src/lib/notifPrefs.ts`; Settings and the hook had private copies. Brand: the sidebar shows the SmartGift wordmark with the AgentHub caption under it, the collapsed rail shows the mark, and the favicon is vendored to match.
126 KiB
Lanes: Parallel Agent Work Units
A lane is a durable unit of parallel agent work — one working directory, many Claude Code sessions over time. This document describes what lanes are, how to use them, and how the dashboard displays pipeline progress.
What is a lane?
A lane persists across session restarts, which is what makes a pipeline view possible. When you run a Claude Code session, the dashboard binds it to the lane that owns its working directory (cwd) through longest path-boundary prefix matching. This allows:
- Multiple sessions on the same directory to feed into one visible lane
- Nested working directories to own their own nested lanes (deeper paths take precedence)
- A session to migrate from one directory to another without losing its lane relationship
Lanes are keyed by cwd, not `session_id. A session is ephemeral (you run it, it finishes); a lane survives restarts and shows the cumulative progress through a declared pipeline.
Creating a lane
Create a lane bound to a working directory with agenthub lanes add:
agenthub lanes add --cwd /path/to/repo --title "My Feature"
The lane is now ready to track work. When you run a Claude Code session in that directory (or a subdirectory), the dashboard will bind the session to the lane automatically by matching the cwd.
Note: The directory must exist and be an absolute path. A lane with a cwd of /tmp/wt will NOT capture /tmp/wt-sibling (no partial prefix match) but WILL capture sessions in /tmp/wt/subdir/ (subdirectories are owned by the parent lane unless a deeper lane exists).
To provision a dashboard-managed git worktree instead of adopting an existing directory, use a source repository:
agenthub lanes add --repo /path/to/repo --title "My Feature" --base main --slug my-feature
--title, --base, and --slug are optional. The CLI waits for background provisioning to finish and reports either the ready lane or its failure notes.
Adopting your main repo (agenthub lanes add --cwd $(pwd)) is also how you get stage detection working for sessions that work directly in it rather than in a worktree — see "Superpowers skill invocations" below. Once adopted, that lane's own card lists every managed-worktree lane whose source_repo matches its cwd, each a clickable link to jump to that lane.
Adding a lane through the dashboard's "+ Add lane" flow also auto-runs, best-effort, in parallel: agenthub lanes profile init (only if a Node.js project is detected — most repos won't be, and that's a normal outcome, not a failure), agenthub lanes agents install, and agenthub lanes mcp sync. None of the three blocks the lane from being created or from each other — a lane whose repo has no MCP servers configured, for instance, still gets created and is still usable, just without a synced .mcp.json. The modal shows a ✓/✗ summary of the three results and stays open until dismissed (Cancel/X) — it does not auto-close. Run any of the three manually later (from the lane's own card, or the CLI) if the automatic attempt didn't apply.
The "+ Add lane" modal
The modal has a segmented toggle mirroring the CLI's two modes:
- Repo — adopts the given directory as-is (maps to
agenthub lanes add --cwd). No branch fields; the auto-setup summary above does not run (adopting is instant, nothing to wait on). - Worktree (default) — provisions a managed worktree (maps to
agenthub lanes add --repo). Unlike the CLI, the modal requires you to type the new branch's name yourself rather than deriving one from the title — the underlying route still derives one whenbranchis omitted, so the CLI's behavior is unchanged.
Under the Pipeline template select, a Model endpoint radio chooses between Native (the vendor's own API) and AI Router — a profile saved in Settings › AI Router (9Router, OpenRouter, a self-hosted gateway). Choosing one writes it into the new lane's own config as the lane is created: a claude lane gets the env block of its .claude/settings.local.json, a codex lane gets a $CODEX_HOME/<name>.config.toml layer plus a -p <name> on every spawn. With no profile saved the radio stays on Native and says so. Unlike the lane's tool, this one is not immutable: an existing lane's detail header in Workspace carries a Model select (beside the pipeline picker) showing its current profile, and picking another calls POST /api/lanes/:id/router/apply, rewriting the lane's config and its router_profile column together. (The select is hidden when native is the only profile — there would be nothing to choose.) A failed apply puts the select back rather than leaving the row claiming a router the lane did not get, and marks itself ⚠ with the error in its tooltip. A session already running in the pane is only HALF switched: Claude Code re-applies an env block to a live session when the file changes, but the session's model was resolved at startup, so the previous router's model name keeps being sent to the new endpoint and the next prompt fails with a model-not-found error (switching back to Native included). The route therefore answers restart_required: true plus the run_id whenever a pane is live, and the select renders a Restart button that kills that pane and opens a fresh one — started from the lane id alone, since replaying the old run's --model would re-create the same mismatch. Editing or deleting the profile itself in Settings also reaches every lane using it: an edit re-applies it (so a rotated key actually lands), a delete resets those lanes to Native. See docs/API.md § AI Router profiles.
Under the Pipeline template select, a Create/update readme file checkbox (Claude lanes only — Codex has no slash commands) starts the new lane's terminal run right after creation with /sg-all:sg-md-writing as its first message, so the lane opens already writing/refreshing its CLAUDE.md/AGENTS.md set. It requires the sg-all plugin to be installed in Claude Code; without it the session simply reports an unknown command. Leave it unticked to create the lane without starting a run.
Both modes' path field has a Browse button next to it, opening a small folder browser (GET /api/lanes/browse?path=<abs>) instead of a native OS picker — a browser cannot hand a web page an absolute filesystem path from a native dialog, so this dashboard (local-first, server and browser on the same machine) lists directories server-side instead: click a subfolder to descend, ".." to go up, "Select this folder" to fill the path field. Git repos are marked in the listing.
Lane tool: Claude or Codex
A lane is driven by a tool: Claude (default) or Codex, chosen in the "+ Add lane" modal and immutable once the lane exists. A lane's tool determines which CLI is spawned when a run starts.
claude(default) —claudebinary is invoked; the session's hooks, messages, and tool calls flow through the dashboard. Claude lanes render Sessions, Analytics, cost, and stage-detection badges; liveness is tracked by the Claude Code session.codex(experimental) —codexbinary is invoked instead. The Run Setup panel shows fields for model, sandbox, and approval mode instead of the Claude session picker, and offers "Resume last Codex run" instead of picking a session. Resume usescodex resume --last. Codex lanes render stage-detection badges too, fed from Codex's own rollout journals rather than hooks (see "Stage detection"), but no Sessions/Analytics/cost — and the console never pre-fills the pipeline's Claude slash command into a codex pane.
How Codex arguments map
The Run Setup panel's fields map directly onto codex command-line arguments:
- Model →
codex -m <model>(e.g.codex -m claude-opus-5) - Sandbox (optional) →
-s <mode>where mode is one ofread-only,workspace-write, ordanger-full-access - Approval (optional) →
-a <mode>where mode is one ofon-requestornever - Reasoning effort →
-c model_reasoning_effort=<level>(e.g.medium)
A codex lane's run console shows the full command line before execution.
Limitations of Codex lanes
Codex does not emit Claude Code hooks (sessions, agent events, tool-execution tracking), so the following surfaces remain empty for a Codex lane:
- Sessions and Analytics tabs — no session history or aggregated statistics
- Cost surface — no per-run or per-model pricing data
These are not bugs; they reflect Codex's architecture. The stage you declare via agenthub stage (or that the driving agent calls itself) still works; liveness is tracked by the lane's tmux pane (if the stack is up) and dashboard_runs table (recording every invocation). Cost tracking for Codex runs would require parsing Codex's own logs, a separate design not yet implemented.
Stage detection is not in that list. It does work for a codex lane, from
Codex's own on-disk rollout journals rather than from hooks, and unlike a claude
lane a written detection there also advances the lane's declared stage —
see "Stage detection" below. What a codex lane cannot get for free is
evidence: an auto-advanced node renders passed-no-evidence (amber), never
done, because only the session itself can say what it actually finished. The
run console never pre-fills a Claude slash command into a codex pane (Codex
would read /agenthub:ship-feature-lane as prose), so a codex session declares
evidence only when something tells it to. Three things do:
- An opening prompt checklist. The Run Setup panel pre-fills a codex pane's
first prompt with a plain-text list of
agenthub stage <stage> --tool codexcalls to make, one per node of the lane's own pipeline template (built fromLane.pipeline_nodes, so it always matches whatever template is in use) — the same up-front priming a Claude lane gets from its pre-filled/agenthub:ship-feature-laneskill command, just as plain text since Codex has no slash commands. SeeLaneConsolePane.tsx'spromptPrefill. - An
AGENTS.mdblock.agenthub lanes agents installon a codex lane writes a marker-delimited<!-- agenthub:stage:start -->section into<lane cwd>/AGENTS.md— the one instruction channel Codex actually reads, since it never loads.claude/agents/. Appended, never overwriting your own prose, and a reinstall replaces exactly that block. (On aclaudelane the same command still copies the two agent templates instead.) - A missing-evidence nudge.
server/lib/codex-nudge.jssweeps every 60s (DASHBOARD_CODEX_NUDGE_MSto change,0to disable) for a codex lane whose current stage has been held for at least two minutes with no evidence recorded, and types a one-line[agenthub] ... run: agenthub stage ... --evidence "..."reminder straight into that lane's live tmux pane (tmux.sendText, skipped if the pane is at a bare shell prompt). It never writesstage,stagesordetected_stageitself — the evidence that results is a real declaration the session made.
Destructive lane actions
Reset a managed worktree, remove one, or purge the lane's eligible session history with the CLI:
agenthub lanes reset <id> [--force] [--keep-db] --yes
agenthub lanes remove <id> [--force] --yes
agenthub lanes purge <id> --yes
Each command first fetches and prints its preflight counts. reset and remove show head, dirty, untracked, and unpushed (plus database, the name a data-isolated lane's reset will drop — remove drops no database at all; see "Data isolation" below); purge shows sessions, events, and tokenRows. The action refuses to run without --yes, and sends those exact facts back as its confirmation. Use --force only when the preflight reports unpushed commits — it applies to reset alone, since remove deletes nothing that could hold them. --keep-db (reset only) skips the whole drop-recreate-migrate-reseed sequence, leaving the lane's database exactly as it was. An adopted lane points at a directory you own, so the CLI refuses to reset it. remove is allowed for every lane kind, adopted or managed, because it drops only the dashboard's record and leaves the working tree, its branch, and its database (if any) untouched — deleting those is yours to do by hand.
Lifecycle
The two lane kinds
managed— a git worktree the dashboard itself created (agenthub lanes add --repo), rooted underLANES_ROOT. The dashboard may reset that worktree to its base branch. It does NOT delete it: removing the lane forgets the dashboard's record and leaves the directory and its branch on disk.adopted— an existing directory you already had (agenthub lanes add --cwd). The dashboard only ever tracks it; it never resets or deletes that worktree. "Removing" an adopted lane drops the dashboard's record of it and leaves the directory untouched.
The three independent safety checks
Before reset touches a worktree, assertDestroyable (server/lib/worktree.js) runs three checks, all of which must pass:
lane.kind === "managed". An adopted lane fails immediately withENOTMANAGED— this check alone is what keeps a directory you own off the destroy path.- The lane's
cwd, resolved withfs.realpathSync, must sit inside the resolvedLANES_ROOTon a path boundary.path.relative(root, cwd)must not start with..or be absolute —EOUTSIDEROOTotherwise. This guards against a lane row that was hand-edited or drifted to point somewhere else. - The resolved path must actually appear in
git worktree list --porcelainfor the lane'ssource_repo—ENOTWORKTREEotherwise. A directory that merely happens to sit underLANES_ROOTbut was never registered as a worktree of that repo is not destroyed.
These checks run unconditionally inside resetWorktree/removeWorktree themselves, not only when a confirmation is present — there is no code path to a git-destructive operation that skips them.
removeWorktree (with its prune path for a hand-deleted directory) still lives in server/lib/worktree.js and still runs those checks, but no route calls it any more: the lane remove action no longer destroys anything. It is kept as a guarded primitive, not a reachable lane verb.
Each verb
add— either adopts an existing directory (--cwd, kindadopted) or provisions a new managed worktree (--repo, kindmanaged, created underLANES_ROOTon branchfeat/<slug>).clear(UI/API action only, no CLI verb) — resets the lane's own bookkeeping (stage, status, gate/CI fields, notes) back to idle, including the detected columns (detected_stage/detected_signal/detected_at), since detection is forward-only and a surviving detection would both claim progress the reset tree no longer has and block every later detection. Touches only thelanesrow; no git operation, no session/event data is deleted.reset(managed lanes only) — checks out the base branch,git reset --hardto it, thengit clean -fd(no-x, so gitignored files such asnode_modulesand.envsurvive; only untracked-but-not-ignored files are deleted), then recreates the feature branch off the base and clears the lane's bookkeeping. Requiresforce: truewhen the preflight reports unpushed commits.remove— deletes the dashboard's record of the lane and nothing else, for every lane kind. The working tree stays on disk, its branch stays in the source repo, git's own worktree bookkeeping is untouched, and the lane's database (if any) is left in place; deleting any of them is the user's own call (git worktree remove,git branch -d, dropping the database). Stopping the lane's run and stack still happens first — those are processes, not data — and the runtime bookkeeping underLANES_ROOT/.state/lane<slot>/(pid files, hook logs) is cleared, because it is AgentHub's own and would otherwise be inherited by the next lane to claim that slot. Consequently there is no unpushed-commits force-gate onremove: nothing it does can discard a commit.purge— deletes the lane's ownsessions/events/token_usagerows (excluding the lane's currently-bound or any still-active session), for its owncwdand subdirectories. No git operation, no worktree change; not gated on unpushed commits.
The preflight contract
GET /api/lanes/:id/preflight?action=reset|remove|purge (server/lib/lane-preflight.js) is read-only and returns:
reset/remove:{ action, lane, kind, branch, head, dirty, untracked, unpushed, database, blocked[], warnings[] }purge:{ action, lane, sessions, events, tokenRows, bytesEstimate, activeSessionSkipped }
blocked[] can contain: adopted (not a managed worktree), missing (the directory is gone), unreadable (directory exists but git failed against it), and unpushed-commits (unpushed count > 0 — the only one a force: true can override).
Which entries actually prevent the action depends on the action, and the server is the authority. All of them block reset. None of them blocks remove, including unpushed-commits: removal only deletes the lane's row, so an adopted lane, a hand-deleted directory and an unreadable one are all removable and none of them risks anything on disk. For remove the preflight counts are context, not a destruction manifest. A surface that greys out confirmation on any blocked entry regardless of action makes a documented capability unreachable; client/src/components/lanes/DestructiveLaneModal.tsx encodes the per-action set in HARD_BLOCKERS and renders the rest as context.
unpushed is the count of commits the action would really discard: with remotes, commits on no remote; without remotes, the commits ahead of the lane's base_branch, which is this lane's own work. A freshly provisioned worktree in a local-only repository reports 0, not that repository's whole history — the no-remote warning, not an inflated count, is what tells the user nothing is backed up. A lane with no base_branch at all (an adopted one) falls back to the total commit count. warnings[] holds purely informational facts that never gate the action: currently just no-remote (no git remote configured at all — nothing here is backed up remotely, but the action proceeds normally). Both arrays are data, not an exception.
database is the database name a reset (unless --keep-db) will drop — remove never drops one — null when the lane has no slot yet or its profile declares no DB_PREFIX. It is derived, not stored, the same way slot/ports are.
bytesEstimate is a rough estimate, not a measured disk size: it is derived as (events + tokenRows) * 512, a flat per-row byte guess, purely to give the confirmation dialog an order-of-magnitude sense of what purging will reclaim.
Every destructive POST /api/lanes/:id/:action must echo back an expect object with exactly the fields listed above for that action. The server re-runs preflight at execution time and rejects the request (400 EEXPECT if incomplete, 409 ESTALE if any field has changed since the client read it) rather than trusting a client-supplied count.
Environment variables
LANES_ROOT(default~/.claude/agenthub-lanes) — the directory managed worktrees are provisioned under; also the boundary that safety check 2 resolves paths against.LANE_DEAD_SEC(default300) — seconds of silence before a lane whose stage matches/watch|poll/iflips fromactivetodeadliveness.LANE_BASE_BRANCH(defaultmain) — the base branch a new managed worktree resolves against when a request omitsbase. An explicit--base <branch>(or request bodybase) always wins over this default.LANE_BRANCH_PREFIX(defaultfeat/) — the prefix used to build a new managed worktree's feature branch name (<prefix><slug>).
Limitation: a fresh worktree has no dependencies
agenthub lanes add --repo runs git worktree add only. It does not run npm install (or any other package manager), and it does not copy the source repo's untracked local files (.env, IDE config, etc.) into the new worktree. A managed lane is ready for git immediately but needs its own dependency install and local env setup before a session can run the project inside it.
A repository can close the dependency half of that gap itself by declaring a bootstrap hook in its profile (below) and running agenthub lanes hook bootstrap. Seeding a lane's .env and its database is handled automatically once the profile opts in — see "Data isolation" below.
Lane runtime: running a lane's own stack
A lane isolates code. Without more, two lanes running their project at the same time collide on everything else — the same ports, the same directories. The runtime layer gives each lane its own slot, and derives its ports and per-lane directories from it.
This is resource namespacing on the host, not a container: lanes run as the same user, share the network, and can read any file you can. If you need stronger isolation than that, this is not it.
Declaring a profile
Everything stack-specific lives in the repository, at <repo>/.agenthub/profile/. AgentHub is multi-repo, so there is no global profile setting — a profile travels with the repo it describes, and therefore already exists in every worktree cut from it.
myapp/
.agenthub/profile/
profile.env
hooks/
bootstrap.sh boot.sh health.sh
migrate.sh seed.sh ci-gate.sh e2e.sh regen.sh
db-create.sh db-drop.sh
profile.env is a KEY=VALUE declaration file. It is parsed, never sourced — $(…), backticks and ${VAR} are kept literally, because sourcing arbitrary shell from a repository into the dashboard process would be a code-execution path. Hooks are executed on purpose; config is only read.
# .agenthub/profile/profile.env
PORTS="api fe worker" # names; each gets a <NAME>_PORT in the hook environment
PORT_BASE_api=8000 # lane in slot 3 prefers :8003
PORT_BASE_fe=3000
PORT_BASE_worker=9000
LANE_DIRS="uploads .cache" # directories created per lane, inside its working copy
BACKEND_DIR=backend
FRONTEND_DIR=frontend
Every key has a default, so a missing one never breaks a lane: PORTS="api fe", PORT_BASE_api=8000, PORT_BASE_fe=3000, LANE_DIRS="", BACKEND_DIR=backend, FRONTEND_DIR=frontend, API_PATH=/api. A port name with no declared base falls back to 8000.
AgentHub resolves the profile from the lane's own working copy first, then its source repository. A branch that changes a boot command must boot with the command it changed; the source-repo fallback exists for a profile kept gitignored, which never reaches a worktree through git.
Scaffolding a profile automatically
agenthub lanes profile init <repo> [--force] # detect + write .agenthub/profile/
agenthub lanes profile check [<path>] # validate one (path defaults to cwd)
profile init currently detects Node.js only, in exactly two layouts: a root package.json (single-service), or backend/package.json and frontend/package.json both present (monorepo, checked first). Anything else — Python/Go/Ruby, a pnpm/yarn/turborepo workspace, non-standard directory names — is refused with an actionable message rather than guessed at; write .agenthub/profile/ by hand for those, following the reference above.
Detection reads package.json (which of start/dev/preview exists) and docker-compose.yml (a service matching /postgres/i or /redis/i), never executes anything, and never guesses a migration tool: a detected database gets migrate.sh/seed.sh scaffolded as an explicit, always-exit 0 TODO stub, not a guessed Prisma/Knex/TypeORM command. profile check is the hard gate — it fails (non-zero exit, every problem listed) on any leftover TODO:, any missing or non-executable hook, or a declared port already in use; it only warns when ~/.agenthub/secrets.env doesn't exist yet for a database-declaring profile.
profile check takes a path, not a lane id or --lane/--cwd flag like every other lanes subcommand — it is meant to run against a bare repository right after init, before any lane or worktree exists for it.
Slots and ports
A slot is the small integer every runtime fact derives from. Slots are allocated lazily — a lane that is only ever watched never takes one — from 1..LANE_MAX_SLOTS (default 9), lowest free first, and are freed when the lane is removed. A reset keeps the slot: moving a lane's ports out from under a session mid-feature would be a silent, confusing failure rather than a fresh start.
Ports prefer PORT_BASE_<name> + slot. When that number is already in use, the allocator steps aside by +100, +200, … up to ten times, which keeps the last digit equal to the slot so a stepped-aside port still reads as "lane 3". The number a lane actually got is recorded in lanes.ports and reused on the next boot, so a lane's URL does not move once it has one. A number is rejected when something is listening on it, when another lane has recorded it (a lane whose stack is down still owns its number), or when an earlier port name in the same boot took it.
If every candidate is busy the boot fails with EPORTBUSY, naming the process holding the preferred port.
The hook contract
Before running a hook, AgentHub exports:
| Variable | Value |
|---|---|
LANE |
the slot number (not the lane id) |
LANE_ID |
the lane id |
LANE_DIR |
the lane's working copy |
SOURCE_REPO |
the repository it was cut from |
PROFILE_DIR |
the resolved .agenthub/profile |
RUN_DIR / LOG_DIR |
pid files and logs, under $LANES_ROOT/.state/lane<slot>/ |
<NAME>_PORT |
one per declared port, upper-cased (PORTS="api fe" → API_PORT, FE_PORT) |
everything in profile.env |
verbatim |
Two shell helpers are injected: die <msg>, and harness_spawn <name> <workdir> <cmd…> which backgrounds a long-lived service with fully detached stdio and records its pid at $RUN_DIR/<name>.pid. Use harness_spawn in boot — a child that inherits the caller's stdout holds that pipe open, and the hook never returns.
Inherited GIT_* variables are scrubbed exactly as server/lib/worktree.js scrubs them, so a hook that shells out to git cannot inherit a git context pointing at the dashboard's own repository.
# .agenthub/profile/hooks/boot.sh
#!/usr/bin/env bash
set -euo pipefail
harness_spawn api "$LANE_DIR/$BACKEND_DIR" npm run start -- --port "$API_PORT"
harness_spawn fe "$LANE_DIR/$FRONTEND_DIR" npm run preview -- --port "$FE_PORT"
# .agenthub/profile/hooks/health.sh
#!/usr/bin/env bash
set -euo pipefail
curl -sf --retry 30 --retry-delay 1 --retry-all-errors "http://127.0.0.1:$FE_PORT/" >/dev/null
Runnable hook names are a fixed allowlist: bootstrap, boot, health, migrate, seed, ci-gate, e2e, regen, db-create, db-drop. A name from a request is never turned into a path.
Up, down, and surviving a restart
agenthub lanes up # boot the lane owning this directory
agenthub lanes up 3 --no-build # boot lane 3, reusing an existing build
agenthub lanes runtime # slot, ports, service liveness, last boot error
agenthub lanes logs api # tail one service or hook log
agenthub lanes down # stop the stack
agenthub lanes hook ci-gate # run any allowlisted hook
up runs boot then health. It deliberately does not run bootstrap — installing dependencies on every boot would make a routine restart minutes long. A failing health check leaves the processes running: their logs are what tell you which service never came up, and killing them to report a tidy failure destroys the evidence.
Services are fully detached, so a lane's stack outlives the dashboard. Restarting or updating AgentHub does not touch a running lane. Nothing has to re-adopt them either: whether a stack is up is recomputed from pid files and port probes on every read, never cached, because a process can die to OOM or a stray kill without telling anyone.
down kills each recorded pid tree bottom-up (a parent killed first reparents its children to init, where nothing knows to look for them), then — only when there was a pid file — sweeps any listener still on the lane's ports. That condition matters: a lane whose stack is already down still owns its port numbers, and an unconditional sweep would kill a server you started there yourself.
While a hook runs, each output line is broadcast as a lane_hook_output WebSocket message ({ laneId, hook, stream, line }) and also appended to $LOG_DIR/<hook>.log. A boot ends with lane_runtime (fresh facts, or an error); a hook run started through POST /api/lanes/:id/hook/:name ends with lane_hook_result carrying its exit code. That is what lets a lane card show live progress through a multi-minute build instead of a disabled button that reads as a hang.
What the runtime does and does not write
The runtime writes slot and ports on the lane row, and nothing else. It never writes stage, status or notes.
In AgentHub those describe the agent's work, not the stack's state: status=running means a session is working, and a booted server is not a session. Conflating them would corrupt lane liveness. This is the same boundary as "the console never writes a lane's stage". Boot failures live in $LANES_ROOT/.state/lane<slot>/last-error.json and surface through GET /api/lanes/:id/runtime.
Adopted lanes may be brought up and down — up only runs what you could run yourself — but every path that writes into their working copy is refused.
Runtime environment variables
LANE_MAX_SLOTS(default9) — how many lanes may hold a runtime at once. Nine keepsbase + slotreadable as a single digit; raising it costs that readability.LANE_BOOT_TIMEOUT_MS(default900000) — hard limit on theboothook.LANE_HEALTH_TIMEOUT_MS(default180000) — hard limit on thehealthhook; a health check that never returns is a failed boot, not an eternal wait.LANE_PORT_PROBE_MS(default300) — connect timeout when probing whether a port is in use.
Data isolation: database, Redis and .env (A2)
Two lanes running their stack at once need more than separate ports — they need separate data, or one lane's migration corrupts the other's session. This is the other half of runtime isolation, and every piece of it is off by default: a profile that never declares DB_PREFIX gets no database, REDIS=1 gets no Redis index, and no ENV_FILES gets no .env writes at all.
Profile declarations (.agenthub/profile/profile.env, all optional):
DB_PREFIX="myapp_l" # lane in slot 3 -> myapp_l3 ; empty = no per-lane DB
DB_KIND="postgres" # informational
DB_URL_SCHEME="postgresql" # DATABASE_URL scheme
REDIS=1 # 1 = allocate a logical Redis index = slot
# (stock Redis ships 16 logical DBs, 0-15 — keep
# LANE_MAX_SLOTS <= 15 if REDIS=1 is declared)
ENV_FILES="backend/.env" # file(s) to seed, relative to the lane
ENV_SOURCE="backend/.env" # source path in the source repo (defaults to ENV_FILES)
ENV_REWRITE="DATABASE_URL REDIS_URL UPLOAD_DIR" # keys AgentHub overwrites per lane
ENV_PRESERVE="JWT_SECRET" # keys kept from the lane's OWN file on a --force refresh
UPLOAD_SUBDIR="backend/data/uploads" # exported as UPLOAD_DIR
A ready-to-copy template (including db-create.sh/db-drop.sh for a Postgres-in-docker-compose stack) lives at server/data/profile-templates/postgres-compose/.
Machine-level credentials live at ~/.agenthub/secrets.env (mode 0600), never in the repo:
PG_HOST=127.0.0.1
PG_PORT=5432
PG_USER=postgres
PG_PASS=postgres
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
Parsed with the same literal KEY=VALUE reader as profile.env — never sourced. A missing file falls back to those same defaults (with a one-time warning); a file readable by group or world is refused outright rather than trusted. No route ever returns a value from this file — GET /api/lanes/:id/runtime reports a database's name and a Redis index, never a connection string.
Who creates the database? A db-create.sh / db-drop.sh hook (already in the allowlist) — AgentHub stays stack-agnostic, since createdb vs mysqladmin create vs touch foo.db genuinely differ. Who rewrites .env? AgentHub itself: mechanical and identical across stacks, so pushing it into every repo would duplicate the same ~30 lines.
Hook environment additions, present only when their owning declaration is (a db-create.sh that forgot to check DB_PREFIX fails loudly on an unset variable instead of touching a database named "undefined"):
| Variable | Present when | Value |
|---|---|---|
DB_NAME |
DB_PREFIX set |
<prefix><slot> |
DATABASE_URL / TEST_DATABASE_URL |
DB_PREFIX set |
full connection string to DB_NAME / DB_NAME_test |
PG_HOST / PG_PORT / PG_USER |
DB_PREFIX set |
from secrets.env (PG_PASS is deliberately withheld — nothing in the ported hooks needs it) |
REDIS_URL |
REDIS=1 |
redis://<host>:<port>/<slot> |
REDIS_HOST / REDIS_PORT |
REDIS=1 |
from secrets.env |
UPLOAD_DIR |
UPLOAD_SUBDIR set |
<lane>/<UPLOAD_SUBDIR> |
When each step runs:
- Provisioning a new managed worktree (
agenthub lanes add --repo) — after the worktree is created: seed.env, runbootstrap, create the database,migrate,seed. Runs once. up— repair.env(a hand-edited or never-seeded file gets fixed), ensure the database exists (cheap when it already does),migrateon every boot (a lane's schema drifts while it sits idle), andseedonly on the boot that actually created the database.reset— refresh.envwith--force(preservingENV_PRESERVEkeys from the lane's own file — swapping in the source'sJWT_SECRETwould 401 a running lane's tokens until reboot), re-runbootstrap(a reset can land on a branch with new dependencies), clear the declaredLANE_DIRS, then drop, recreate, migrate and reseed the database — unless--keep-db, which skips that whole block.remove— drops nothing.removeLaneDatastill exists inserver/lib/lane-runtime.js(and still refuses an adopted lane), but theremoveaction no longer calls it: a lane's database is the user's data and outlives the dashboard's record of it. Drop it yourself when you actually want it gone.
A missing source .env falls back to .env.example with a loud warning, never a silent success. And any hook output that echoes a value from secrets.env (the password, specifically) is redacted before it reaches $LOG_DIR/<hook>.log or the lane_hook_output WebSocket message — that stream reaches a browser tab, and a hook debugging its own environment must not publish a database password to everyone watching.
The Workspace page (/run)
The dashboard web UI merges lanes and runs into a single Workspace page accessible at /run (the old /lanes route now redirects here). Top to bottom:
- No page header. The page title and the four counters (
lanes,running,needs you,dead) are gone: the lane strip below already shows every lane with its own liveness dot and its ⚠ marker, so the counters restated it a row higher and cost height on a screen whose point is the terminal.GET /api/lanesstill returnscountsfor other callers. - Lane strip — the horizontally scrolling row of lane tiles. Its FIRST tile is Add lane (dashed border, no liveness dot), not a header button: creating a lane is the same kind of act as picking one, so it reads as the empty slot at the head of the row. A tile shows the lane's id as a bare
#23— not "Lane 23", which cost a third of the row's width and said nothing, though the number itself stays because that is how the CLI addresses a lane. - Reordering the strip — drag a tile onto another to move it there, or press Alt+←/→ with a tile focused (the keyboard path; HTML5 drag-and-drop has no touch support and does not auto-scroll an overflowing strip). The order is a per-viewer preference, not a lane fact: it persists to
localStorage(agenthub.workspace.laneOrder) exactly like the split-view layout beside it, and writes nothing server-side —GET /api/lanesandagenthub laneskeep answering in id order, and the order does not follow you to another browser. A lane the stored order has never seen (created since, or created in another tab) lands at the END rather than wherever a stale index would put it; a stored id whose lane is gone is skipped. - Renaming a lane — the detail header's name is a button: click it (a pencil appears on hover) to edit in place. Enter saves via
PATCH /api/lanes/:idwith{title}, Escape and clicking away both cancel, and saving an empty name clears the title, which puts the lane'scwdback in its place. Renaming is display-only — a managed lane's branch name was slugified from its title once, at creation. - Lane-detail header row — one row, and every per-lane control lives on it: liveness + status, the lane's name (no "Lane 23 ·" prefix — the id is on the strip tile), time-on-stage, the pipeline picker, the Model (AI Router) select, stage badges, the feature picker, and on the right the Tools menu (agents install / mcp sync / sync-base check, hidden when the lane declares no runtime profile), the info toggle, the split-view toggle and Remove. Tools sits here rather than in Settings because all three of its actions run against one lane's
cwd— in Settings it would need a lane picker just to say which. - Detail panel — the selected lane's declared stage, its inferred stage when detection leads, a full-width pipeline map, and a legend naming all five node states plus the dashed-amber inferred treatment.
- Terminal — a real interactive terminal (xterm.js) displaying the tmux session's PTY output, with full support for interactive commands, editors, and pagers. A live run keeps its rendered history and scroll position when scrolling.
- Split view — a layout toggle (one pane / two side by side / a 2×2 grid, drawn as icons rather than the words, with the count kept as each button's
aria-labeland tooltip) renders that many independent terminal panes side by side (grid-cols-2for 2, a 2×2 grid for 4). Layout 1 is bound to the lane strip's selection, same as always; layouts 2 and 4 give each pane its own lane picker, independent of the strip. The chosen layout and each pane's lane persist tolocalStorage(agenthub.workspace.splitView) across reloads. - Lane grid — one card per lane, 1 column, 2 at
md, 3 atxl. Each card carries the lane id, liveness dot and status, title, declared stage and time-on-stage, theauto:chip when detection leads, the kind and CI tags, the working-copy facts fromGET /api/lanes/:id/git, the needs-you banner, and the action row.
Run history is per lane, queryable via GET /api/run/history?laneId=<n>.
A console pane follows the lane it shows. Selecting another lane — from the lane strip in layout 1, or from a pane's own lane picker in layouts 2 and 4 — swaps that pane's cwd, run history and terminal over to the new lane. If the new lane already has a live run in GET /api/run, the pane re-attaches to it immediately, so each lane sticks to its own agenthub-lane-<id> tmux session; if it has none, the pane shows that lane's setup form. Nothing of the previous lane (a half-typed prompt, its terminal) carries over.
The working directory field tracks the selected lane's own cwd specifically, and re-syncs as soon as that path is known rather than only when the selection changes — a pane can render before GET /api/lanes has answered (split view restores its pane lanes from localStorage), and its lane id never changes afterwards. RunSetup submits that string verbatim to POST /api/lanes/:id/start, so a cwd left over from the previous lane or from the home default would start the run in the wrong folder. The home suggestion is used only while no lane is selected at all.
Picking a session to resume starts it right away. In the setup form's Fresh/Resume switch, choosing a session from the resume picker fires the start immediately — POST /api/lanes/:id/start with that resumeSessionId and the session's own cwd — and the pane switches straight to the terminal. A resume carries its own transcript, so there is nothing to type first: the prompt box stays optional for resumes (the Run button no longer requires it) and required for fresh runs. Type into the tmux terminal once it's attached.
Active runs list
The Active runs button in the console header opens the merged run list. It shows three sources in one place, newest first:
- live in-memory tmux runs from
GET /api/run, - persisted dashboard runs from
GET /api/run/history, - Claude Code sessions running outside the dashboard —
GET /api/sessions?status=active, i.e. aclaudethe user started by hand in a terminal tab. These carry an amberexternalbadge, and the button's live count includes them, so two hand-started agents read as "2 active runs".
An external session is deduped against a dashboard run with the same session_id, and sessions from a remote data source (source !== "local") or without a cwd are skipped — neither can be resumed on this machine.
External rows have no Attach action: the dashboard owns no tmux session for them, so there is no PTY to bridge. Their action is Resume, which does what resuming from history does — POST /api/lanes/ensure for the session's cwd, then POST /api/lanes/:id/start with resumeSessionId — spawning a new tmux-backed claude --resume <session> in that folder. The original terminal keeps running; resuming gives you a second Claude Code process on the same transcript, not a view of the first one.
Start and Resume are create-or-reuse, and never silently swallow the request. When the lane's agenthub-lane-<id> tmux session does not exist, it is created with the full argv. When it exists but its pane is sitting at a shell prompt (a agenthub lanes shell you opened, or a claude that has since exited), the argv is typed into that pane — so --resume really runs, and an initial prompt really lands, in the session you are already looking at. Only when the pane is running something (a live claude, an editor, a build) is the request adopted as-is: attaching shows you what is running rather than typing over it. Before this, an existing session was always adopted silently, so the first Resume after a agenthub lanes shell answered 200 while doing nothing at all.
The UI operates on a working directory (cwd), not a lane id. Starting a run in a cwd that no lane owns calls POST /api/lanes/ensure first, to idempotently find or adopt a lane for that path; a cwd an existing lane already owns is matched from the loaded lane list without a round trip. Either way the run is then started through POST /api/lanes/:id/start rather than directly through POST /api/run.
Finding or adopting a lane: POST /api/lanes/ensure
The Workspace page opens on a cwd and needs a lane to exist for that directory without ever creating a duplicate. The ensure endpoint handles this:
curl -X POST http://localhost:4820/api/lanes/ensure \
-H "Content-Type: application/json" \
-d '{"cwd": "/absolute/path/to/work", "title": "My Project"}'
Response:
{
"lane": { "id": 5, "cwd": "/absolute/path/to/work", "title": "My Project", ... },
"created": false
}
- If a lane already owns the
cwdfor the requestedtool, returns that lane withcreated: falseand HTTP200.tool(claudeorcodex, defaultclaude) is part of the identity: adopting the samecwdwith a differenttoolcreates a second, sibling lane rather than adopting the existing one — onecwdcan back at most oneclaudelane and onecodexlane at a time. This applies to Repo/Adopt mode only; Worktree mode always gets its own directory. - If the
cwdis a subdirectory of an existing lane with that same tool, returns the parent lane that owns it. - If no lane owns the
(cwd, tool)pair, creates an adopted lane and returns it withcreated: trueand HTTP201. - A relative or missing
cwdreturns400 EBADCWD.
Two concurrent calls for the same (cwd, tool) pair always yield one lane: the database's composite UNIQUE index on lanes(cwd, tool) decides the winner, and the loser re-reads and returns the winning lane.
Reading a lane's working copy: GET /api/lanes/:id/git
Each lane card shows the branch its working copy is actually on, the short HEAD, that commit's subject, and how much is uncommitted:
curl http://localhost:4820/api/lanes/5/git
{
"available": true,
"branch": "feat/rename-metric",
"head": "9b3e74a",
"subject": "free-text rule mode in the form",
"dirty": 2,
"untracked": 1,
"files": [
{ "path": "server/lib/alerts.js", "status": " M", "added": 12, "deleted": 3 },
{ "path": "client/src/lib/api.ts", "status": "M ", "added": 1, "deleted": 0 },
{ "path": "scratch.txt", "status": "??", "added": null, "deleted": null }
]
}
- A
cwdthat is missing, is not a git repository, or makes git fail returns{"available": false}with HTTP 200. A lane pointing at a plain directory is a normal state, not a fault, and the card simply renders without a git row. - A detached checkout reports the literal
HEADthat git returns, rather than a prettier invention. filesnames the files the two counts came from, capped at 20 — a lane mid-npm installwould otherwise ship thousands of paths through a polled endpoint. The counts are never capped, so the panel that shows this list says… and N more fileswhen it is showing less than all of it. Each entry carries its two-charactergit status --porcelaincode (status, for a rename thepathis the NEW one) and its line delta.added/deletedcome from onegit diff --numstat HEAD, which covers staged and unstaged work together. They arenullwhen git has no delta to report: an untracked file (git has never seen it — its content is deliberately not read off disk, since a lane mid-build can have a 100 MB artifact), a binary file, a rename (numstat keys those differently), or a repo with no commit to diff against yet.- Hovering (or focusing, or tapping) the
N modified · N untrackedtext on a lane card opens this list as a panel: one row per file, its status letter colour-coded, the directory truncated before the filename ever is, and each row's+N −Maligned on the right under a total. - An unknown lane id is a
404.
This is not folded into GET /api/lanes on purpose: it shells out to git
five times, and the lane list is polled and re-broadcast on every hook-driven
lane_update. Putting it there would fire a burst of subprocesses behind every
tool call an agent makes. The browser fetches it per card instead, on mount and
every 30 seconds, and a failed fetch is silent.
Viewing lanes
List all lanes with their current status:
agenthub lanes
This shows each lane's:
- stage: the declared stage (e.g.,
plan,implement,review,done) - status:
running(a session is active),idle(no active session), orprovisioning - liveness:
active(recently updated),dead(silent for too long), oridle(not expected to be running) - progress: percentage of the pipeline completed (0–100%)
- needs_action: a notification if the session is blocked waiting for input
A lane row also gets a ⇢ detected:<stage> suffix when the server's inferred
stage (see "Stage detection" below) leads the declared stage shown in the
row — the same lead/behind comparison the web UI's auto: <stage> chip uses,
so the terminal and the browser never disagree about which one is the
headline. Nothing is printed when the declaration already leads or matches.
The dashboard web UI shows each lane as a card in a grid, with the selected lane's pipeline map visualized above.
Pipeline stages and the five node states
A lane moves through stages defined in a pipeline template (see "Custom pipeline templates" below). The default pipeline has eight stages: intake, plan, implement, tests, review, gate, ship, and done.
A lane is created on default unless told otherwise. The "+ Add lane" modal has a Pipeline template select listing every template the server reports, so this is chosen at creation; agenthub lanes add --pipeline <id> is the same choice from the terminal.
For a lane that already exists, switch it from the terminal:
agenthub lanes pipeline # which template this lane uses, and what else exists
agenthub lanes pipeline ship-feature # switch it
or from the dashboard: the pipeline-template select next to the lane's title in the Workspace detail panel does the same PATCH /api/lanes/:id the CLI uses, live (disabled while viewing an archived feature snapshot).
The template names the skill that drives it. "skill": "/agenthub:ship-feature-lane" on the 16-node ship-feature template, "skill": "/agenthub:ship-feature" on the 8-node default one. It rides along on every lane payload as pipeline_skill, and from a terminal there is one command per depth of work — the command you type picks the pipeline, so no agenthub lanes pipeline step first:
cd ~/lanes/myrepo__feat-export
# 16 stages: ends in a published PR, watched until a human merges it
agenthub ship-full "add an export button"
# → lane switched to `ship-feature`, then: claude "/agenthub:ship-feature-lane add an export button"
# 8 stages: in-repo feature work, stops at review/gate — no PR, no browser QC
agenthub ship-quick "fix the CSV separator"
# → lane switched to `default`, then: claude "/agenthub:ship-feature fix the CSV separator"
agenthub ship-full "add an export button" --print # show the command, switch nothing, run nothing
agenthub ship-full |
agenthub ship-quick |
|
|---|---|---|
| Template | ship-feature (16 nodes) |
default (8 nodes) |
| Skill | /agenthub:ship-feature-lane |
/agenthub:ship-feature |
| Ends at | PR open on development, watched until merged |
ship in the working copy |
| Includes | unit-test agent, CI gates, e2e, code review, local browser QC, senior GO/NO-GO | plan, implement, tests, review, gate |
| Use when | the work should reach reviewers | the work stays local |
The lane is resolved from the working directory, so no id is needed (pass one to target another lane). Each command puts the lane on its own template before spawning, so the dashboard renders the right node count from the first stage rather than after the skill self-corrects; --print switches nothing. The requirement is handed to claude as ONE argv element — never through a shell — so quotes, $ and ; in it are text. A template with no skill field makes the command refuse rather than guess.
Running ONE node
agenthub ship-full / agenthub ship-quick hand the whole pipeline to a skill. When you only want one step — re-run the CI gate, redo the brainstorm, open the PR by hand — run that node's own command:
agenthub lanes node # list every node of this lane's pipeline and its command
agenthub lanes node intake # → claude "/superpowers:brainstorming"
agenthub lanes node intake the export button # extra words are appended to the prompt
agenthub lanes node review # → claude "/code-review"
agenthub lanes node gates # → agenthub lanes hook ci-gate
agenthub lanes node pr-open --print # show the argv, run nothing
Both shipped templates give every node a command, so any of the 16 (or 8) is runnable. A node starting with / is spawned as claude "<command> <extra args>"; anything else is spawned directly. The lane comes from the working directory as usual, and the command always runs in the lane's own cwd.
The node is matched by id or alias, so one name works on either template: default calls the step implement and ship-feature calls it implementing, and agenthub lanes node implement finds it on both.
From inside a Claude session, use the slash commands instead. The plugin ships one per node — /intake, /plan, /implement, /tests, /e2e, /e2e-passed, /review, /qc-plan, /qc, /gate, /publishing, /pr-open, /reported, /watching-pr, /merged, /done — plus /ship-full and /ship-quick for the whole pipeline. Each resolves the node's command through agenthub lanes node <id> --print and runs it in the current session: a slash-command node is invoked directly (never as a nested claude process), anything else runs as a shell argv in the lane's cwd. Extra words are appended to the prompt: /intake the export button.
Two deliberate limits:
- The command is split on whitespace and spawned without a shell. A template is data — files anyone can drop into
DASHBOARD_PIPELINES_DIR— so itscommandis never interpreted as shell. A node needing a pipe or a redirect names a script that contains them. - Running a node does not declare its stage. A command executing is not proof the node passed — the same reason the run console never writes a lane's stage. Declare with
agenthub stage <id>when the work is actually done. (The exception is a node whose command isagenthub stage <id>: there the declaration is the whole step.)
The template also decides what the Workspace run console pre-fills. A template may name the slash command that drives it — "skill": "/agenthub:ship-feature-lane" on the 16-node ship-feature template, "skill": "/agenthub:ship-feature" on the 8-node default one. That string rides along on every lane payload as pipeline_skill, and the run console starts its prompt box with it (plus a trailing space) so you only type the requirement: pick the 16-node template and Run starts the 16-step skill, pick the 8-node one and it starts the 8-step skill. The dashboard never executes it — it is text in a prompt box, exactly as if you had typed it. A prompt you have already edited is never overwritten by a later template switch, and a template with no skill field pre-fills nothing.
Switching re-resolves the lane's existing declared stage against the new node list. A stage the old template knew may resolve to nothing in the new one; the switch warns when that happens (both CLI and UI), and the next agenthub stage fixes it.
Aggregate pass rates across lanes
GET /api/lanes/pipeline-stats answers the other question about node states —
not "where is this lane now" but "how often does this stage actually pass". It
counts every stage record of every lane and every archived feature, grouped
by pipeline template:
entered— records that resolve onto the node (aliases included).failed—result: "fail";passedis the rest, sopassed + failed === entered.withEvidence— the passes that carry evidence, kept apart frompassedbecause a claim and a proof are not the same fact (the same line the five node states draw betweendoneandpassed-no-evidence).
Archived features matter here: a lane's own stages only holds its current
feature, so without them the history would reset every time a lane starts new
work. This is also why new work reported as a bare backwards agenthub stage (see
"Declaring an EARLIER stage") contributes less here than the same work reported
under agenthub feature activate: the backwards declaration prunes the records
ahead of it, so the previous pass leaves nothing behind to count, while a
feature switch archives them first. Neither ever counted passes — one lane row
contributes at most one record per node, however many times it ran — so this
narrows the history, it does not skew a rate. The Workflows page renders this as one bar per node (see
client/src/components/workflows/LanePipelinePanel.tsx).
A new run is opened by a DECLARATION, never by a detection alone. runs is
the denominator every rate on that page is read against, so what counts as a run
decides whether the page is worth reading. Stage detection bounces by design —
one feature's work reads implement → tests → implement → tests as the session
edits, runs the suite, and edits again — and when any backwards move opened a
run, a single feature was recorded as five or six of them. A real pass ends
where the session says it ends: a backwards move only starts a new run when it
is declared (agenthub stage, or a codex lane's ingest-driven declaration). A
detection that moves backwards continues the run in flight. Reaching the last
node still closes the run for both — work after done is new work by anyone's
reading. On this repo's own lane the rule took a 26-run history down to 5, which
is the number of features that were actually shipped through it.
?lane=<id> narrows the same aggregation to one lane and its own archived
features, which is what the panel's lane picker sends. The lanes array in the
response is never narrowed — it populates that picker, so it has to keep
offering every other lane even while the counts show only one.
Attaching a real terminal to a lane
agenthub lanes shell attaches a real terminal to the exact tmux session the dashboard's Start/Resume buttons use for this lane (agenthub-lane-<id>), creating it if it doesn't exist yet. Type claude inside it like any normal terminal session — the dashboard's Workspace terminal view is just another client attached to the same tmux session, so both stay in sync live.
In practice you never have to pick correctly at creation. The template only has to match whichever skill is actually driving the lane, and the skill enforces that itself: ship-feature-lane runs agenthub lanes pipeline ship-feature and ship-feature runs agenthub lanes pipeline default before their first agenthub stage call — a no-op if the lane is already on that template, a self-correction if it isn't. A human chatting with the lane never needs to open the picker; whichever skill gets invoked decides the template.
The dashboard renders every node in the pipeline in one of five states:
| State | Color | Meaning |
|---|---|---|
| failed | Red | The stage recorded result "fail" — work was attempted and rejected |
| current | Blue | The lane's current declared stage |
| done | Green | The stage was recorded with evidence (an artifact, not just a claim) |
| passed-no-evidence | Amber | The stage was recorded without evidence, OR was skipped (a later stage was reached) |
| pending | Gray | Not reached yet |
Why passed-no-evidence is amber, not green
A stage in this state was claimed but not proven. Two scenarios:
- Declared but no artifact left. A skill called
agenthub stage reviewwithout--evidence, claiming the stage happened but leaving no proof that work occurred. - Implicitly skipped. The lane jumped from
plantoimplement(to stage index 2), leavingintake(index 0) inpassed-no-evidencestate.
In both cases, the stage is not done — it's incomplete or untested. Amber signals that the agent claimed to have done this work but the dashboard has no evidence to show it was actually completed. This matters in a pipeline: if your gate checks done not passed-no-evidence, a lane stuck in amber will block until evidence is provided.
Reporting a stage
agenthub stage is not skill-only. Any Claude session working inside an adopted lane's cwd — including a plain chat session where no skill was ever invoked — should call it on real stage transitions. Tool-event detection (see "Inferred vs. declared" below) can only paint the amber "detected" badge; it never moves the blue current ring. A lane worked entirely through plain chat that never calls agenthub stage will keep showing whatever stage it was last declared at (often intake), regardless of how much real work happens.
When a skill — or a plain chat session — reaches a significant milestone, it reports the current stage to the dashboard using agenthub stage:
agenthub stage implement --evidence "Schema created, migrations run"
This command:
- Declares the stage the work is now at
- Records evidence (optional, but highly encouraged) — a short text description of what was completed
- Advances the pipeline map to that node
- Broadcasts to the UI so connected dashboards see the update in real-time
Full command signature
agenthub stage <stage> [--lane <id>] [--cwd <path>] [--tool claude|codex] [--status <s>] [--evidence <text>] [--note <text>] [--result pass|fail]
Parameters:
-
<stage>(required): the pipeline stage name or alias. The default pipeline aliases are:intake/assigned/claimed/startplan/planning/brainstorm/designimplement/implementing/coding/buildtests/testing/unit/gates/pre-push-gatereview/reviewing/code-review/self-reviewgate/verify/verification/sr-gate/gate-blockedship/pr/pr-open/publishing/commit/pushdone/complete/completed/merged
Aliases are per template — the
ship-featurepipeline has its own set (see "Pipeline template: ship-feature" below). A name matching no node and no alias is still recorded verbatim, butphaseIdxthen resolves it to nothing: no node renderscurrentand progress reads0. The CLI prints a warning to stderr and still exits0in that case — a typo must not break a declaration the lane can record, but it must not pass silently either:! "revieww" matches no node in pipeline "default" — recorded, but the pipeline map won't show it. Nodes: intake, plan, implement, …The check is skipped for
--result fail, which paints the nodefailedrather thancurrent. -
--lane <id>(optional): the numeric lane ID. If omitted, the command resolves the lane bycwd. -
--cwd <path>(optional): working directory to match against a lane's cwd. If omitted, uses the current working directory. Useful when calling from outside the repo. -
--tool claude|codex(optional): which tool's lane to address when one directory backs both (see "Which lane a CLI command addresses" below). -
--status <s>(optional): the lane's overall status (running,idle,provisioning). Allows bundling a status update with the stage report. -
--evidence <text>(optional): a short description of what was completed at this stage. Moves the node frompassed-no-evidencetodone. -
--note <text>(optional): a longer note or comment, separate from evidence. -
--result pass|fail(optional): explicitly mark the stage as passed or failed. Ignored ifresultwas already set; set once, never overwritten by a re-report.
Declaring an EARLIER stage (going back)
A declaration may move a lane backwards — that is how a fix-loop re-entry, or a
new request landing on a lane that already reached done, is reported:
agenthub stage plan --note "new request: export to CSV"
Declaring a stage that sits before the lane's current one does two extra things beyond the ordinary transition:
- Clears the detected columns, like every real transition (see "Inferred vs. declared" below).
- Drops the
stagesrecords of every node ahead of the new one. Those records belong to the previous pass. Left in place, a lane declared back atplanwould renderplanascurrentwhiletests/review/donestill readdone— carrying the old work's evidence — andprogress(computed from the declared index alone) would contradict the map beside it. A gate ahead of where the agent now says it is has not been passed for this pass; it has to be re-earned and re-declared.
The node the declaration lands on keeps its own record (its evidence and
result survive), and stage_since restarts, so time-on-phase measures this
pass. Records stored under a key matching no node in the pipeline are left
untouched — their position is unknown, so they cannot be proven to be ahead.
Such keys only exist on lanes that predate validation: POST /api/lanes/:id/stage now rejects a stage naming no node of the lane's pipeline
with 400 EBADSTAGE and lists the ones that exist. Aliases still resolve,
so this catches typos and names borrowed from another template — agenthub stage test on a ship-feature lane, whose CI node is gates — which used to
be stored, warned about on stderr, and then counted nowhere.
Every declaration is also appended to lane_stage_events, the append-only log
the pass-rate report reads. lanes.stages describes the pass in flight and is
overwritten and truncated by the rules above; the log is what remembers that
the previous pass happened at all.
Going back this way is a declaration, not a reset: the lane, its worktree, and
its archived features are untouched. To start a genuinely separate piece of work
with its own archived pipeline, use agenthub feature activate <slug> instead (see
"Per-feature state and archive").
Which lane a CLI command addresses
Every cwd-resolving agenthub command (stage, lanes pipeline, feature activate, lanes up/down/logs, …) shares one resolver, resolveLaneArg in
bin/agenthub.js. It answers in this order:
--lane <id>, or a leading numeric positional.AGENTHUB_LANE_IDin the environment — every tmux pane the dashboard starts carries it (tmux new-session -e, or an assignment prefix when the argv is typed into a pane already at a shell prompt). A session inside a dashboard-started pane therefore never has to guess.--tool claude|codex, then the harness's own marker: Claude Code exportsCLAUDECODE/CLAUDE_CODE_ENTRYPOINT, so a Claude session identifies itself for free. Codex has no equivalent marker (it only readsCODEX_HOME, and setsCODEX_SANDBOX*under a sandbox policy), so a codex session outside a dashboard pane must pass--tool codex.- The lane owning the directory — longest path-boundary match, the same rule the server uses.
The tool matters because one directory can back a claude lane AND a codex
lane (the composite idx_lanes_cwd_tool). With two candidates at the same
directory and no signal from steps 1-3, the command fails and names both
lanes rather than picking one:
2 lanes own /home/me/repo — pass --tool <claude|codex> or --lane <id>: #23 (claude), #33 (codex)
That is deliberate. Silently taking the first would write a codex session's stage onto the claude lane's card — a lie about which agent did the work, and exactly the failure this resolver exists to prevent.
Example: a skill reporting progress
A build skill might call:
agenthub stage implement --evidence "Built and ran tests, 42 tests passing" --status running
Output:
lane #5 → implement (66%)
A later call reports completion:
agenthub stage tests --evidence "Pre-push gate: all linters passing" --result pass
Custom pipeline templates
The default pipeline is suitable for feature work: intake → plan → implement → tests → review → gate → ship → done. For different workflows (data pipelines, research phases, deployment stages), you can provide custom templates.
Where templates come from
- Built-in:
server/data/pipelines/default.json(always available) - User override: directory specified by the
DASHBOARD_PIPELINES_DIRenvironment variable
If both exist, files in the user directory override built-ins with the same id.
Custom template format
Create a JSON file in your custom pipeline directory (e.g., ~/.agenthub/pipelines/ml-training.json):
{
"id": "ml-training",
"name": "ML Training Pipeline",
"skill": "/my-training-skill",
"nodes": [
{ "id": "data", "label": "data", "icon": "📊", "gate": false, "command": "dvc pull", "aliases": ["intake"] },
{ "id": "preprocess","label": "preprocess","icon": "⚙️", "gate": false, "command": "make preprocess", "aliases": ["prepare", "clean"] },
{ "id": "train", "label": "train", "icon": "🧠", "gate": false, "command": "/my-training-skill", "aliases": ["training", "fit"] },
{ "id": "eval", "label": "eval", "icon": "📈", "gate": true, "command": "make eval", "aliases": ["evaluate", "metrics"] },
{ "id": "deploy", "label": "deploy", "icon": "🚀", "gate": false, "aliases": ["ship", "release"] }
]
}
Schema:
- id (string, required): unique identifier for this template
- name (string, optional): display name shown in the UI
- skill (string, optional): the slash command that drives this pipeline (e.g.
"/agenthub:ship-feature-lane"). The Workspace run console pre-fills its prompt with it for lanes on this template; omit it and the prompt starts empty. Never executed by the dashboard. - nodes (array, required): list of pipeline stages, in order
- id (string): stage identifier (used in
agenthub stage) - label (string, optional): display name in the UI; defaults to
idif omitted - icon (string, optional): unicode emoji or single character shown before the stage name
- gate (boolean, optional):
trueif this stage blocks unless explicitly passed; defaults tofalse - command (string, optional): the one command that drives THIS stage — a slash command (
"/superpowers:writing-plans") or a shell one ("agenthub lanes hook ci-gate"). Whereskillabove names the driver for the whole pipeline, this narrows it to the step, so a reader of the pipeline map sees what moves each node instead of inferring it from the node'sdetectregexes. Omit it (or leave it empty) for a node with no single driver; both shipped templates fill every node, using"agenthub stage <id>"for the nodes whose only "work" is the declaration itself (a terminaldone, a gate another agent declares). Surfaced in the node's tooltip on a lane card and as copyable text per node on the Workflows page, and run byagenthub lanes node <id>(below); never executed by the dashboard, same contract asskill. - aliases (array, optional): alternative names for the stage (e.g.,
["training", "fit"]lets you callagenthub stage training)
- id (string): stage identifier (used in
Then set the environment variable:
export DASHBOARD_PIPELINES_DIR=~/.agenthub/pipelines
When you create a new lane, you can optionally specify which pipeline to use:
agenthub lanes add --cwd /path/to/ml-repo --title "Training run #1" --pipeline ml-training
(The pipeline is selected at creation time. Lanes created without --pipeline default to the default pipeline.)
Per-feature state and archive
A lane can carry many features (identified by slug) across its lifetime. Each feature has its own saved pipeline state (stage, status, notes) that persists separately from the live lane — the one every session and the Workspace console observe.
Why: clearLane used to erase the entire lane on each new feature. Now a lane can accumulate many features' saved states, letting you switch between them (via agenthub feature activate) and keep their pipeline histories separate. This matters for proof galleries, parallel task batches, and any flow where one lane runs many intentional phases.
The opt-in model
Nothing changes for a lane that never calls agenthub feature activate — clearLane still erases the live stage and status rows exactly as before. Only when you opt in to features does a lane start archiving. At that point:
clearLanearchives the current active feature (if any) before clearing the live lane row — its saved stage goes into the archive- A lane that has never activated a feature is unaffected by this change and works exactly as it did before feature support
Slug canonicalization
Every feature is identified by a canonicalized slug. The rule is:
- Drop a leading
feat/prefix if present - Replace
/and whitespace with- - Keep
[A-Za-z0-9._-]only - Do NOT lowercase — slugs preserve case
This is a deliberately different rule from worktree.js:slugify's branch-name slugification (which lowercases). The two must never be conflated. Every endpoint and CLI command echoes back the canonicalized form so the caller knows the exact slug that was stored.
Activate semantics
agenthub feature activate <slug> (or the API's POST /api/lanes/:id/features/activate):
- Archives the current active feature (if any and if different from the target slug) — copies its live stage/status/notes to the archive
- Restores the target slug's saved pipeline onto the live lane row — so switching back to a past feature resumes its pipeline exactly where it left off
- Creates a fresh feature row for a never-seen slug (empty stage/status/notes)
- Clears the live lane's detected columns (
detected_stage/detected_signal/detected_at), the same wayagenthub stageandcleardo
This means activating an archived feature twice resumes the same pipeline both times.
Step 4 matters because a detection belongs to the feature that produced it. A never-seen slug starts at stage='idle' with stages={}, which is exactly the shape inferredDisplayStage renders from detection — so a carried-over detected_stage would paint the brand-new feature's map with the previous one's progress, and (detection being forward-only) reject every real detection for the new feature until the old one aged past DETECTION_TTL_MS. Detection is live-only state and is deliberately not snapshotted onto the outgoing archive row: switching back to a feature restores what was declared, never what was inferred.
The Workspace feature picker
The Workspace page's feature picker (read-only) shows every archived and active feature for the lane. Selecting one displays its saved pipeline. It never changes the live lane — a read-only view matching the standing rule that "the console never writes a lane's stage". Changing the active feature requires the CLI or the API route, not a UI button.
CLI commands
agenthub feature list [<id>] # List every feature (archived or live)
agenthub feature activate <slug> [--title text] [<id>] # Switch to a feature (echoes canonicalized slug)
agenthub feature show <slug> [<id>] # Show one feature's saved pipeline
Omit <id> to address the lane owning the current directory.
Stage detection
Besides the stage a skill explicitly declares with agenthub stage, the dashboard
also infers a stage from the tool events every hook already delivers
(POST /api/hooks/event). This is a best-effort heuristic for
un-instrumented sessions that never call agenthub stage — it fills in a lane's
pipeline map without requiring every skill to be rewritten.
Two event sources feed the identical matcher, one per tool:
Lane tool |
Source | Cadence |
|---|---|---|
claude |
hooks — touchLaneFromHook in server/routes/hooks.js |
every hook, live |
codex |
Codex's own rollout journals on disk — server/lib/codex-ingest.js |
poll, DASHBOARD_CODEX_POLL_MS (default 15000; 0 disables) |
Codex has no hook mechanism at all, so touchLaneFromHook is pinned to
"claude" — a hook must never touch a codex lane sharing the same directory.
codex-ingest.js is the codex-side equivalent: it tails
$CODEX_HOME/sessions/<YYYY>/<MM>/<DD>/rollout-*.jsonl ($CODEX_HOME defaults
to ~/.codex), reads the thread's cwd from the session_meta on each file's
first line, and maps Codex's tool calls onto the same {tool_name, tool_input}
shape a Claude hook delivers:
| Codex tool call | Mapped to |
|---|---|
exec / exec_command / shell / local_shell |
Bash with the extracted cmd |
any of the above carrying an apply_patch heredoc |
one Write (for *** Add File:) or Edit (Update/Delete) per touched file |
update_plan |
TaskCreate |
spawn_agent |
Agent with the task name as subagent_type |
| anything else (messages, reasoning, web search, tool OUTPUT) | ignored |
Everything past that point is shared: the same templates, the same forward-only/declared-wins rules, the same amber-never-green boundary. Three codex-only details:
-
A written detection also advances the lane's declared
stage. This is the one place in AgentHub where an inference moves the bluecurrentring, and it exists because nothing else can: a codex session has no hook and rarely callsagenthub stageon its own, so without it the card sits atidleforever while the amber badge is the only thing that ever moves. It is gated onrecordDetectionhaving written, so it inherits that function's forward-only, declared-wins and TTL guards unchanged — a detection behind the declared stage still advances nothing. ThesetStagecall passes no evidence, so every node it moves through renderspassed-no-evidence(amber), neverdone: a detection sees a tool call, never its outcome. And it passeskeepDetection: true, the sole exception tosetStage's clearing of the detection columns — here the detection is the reason for the declaration, so the card keeps showing which command caused it rather than looking like a claim the agent made. The last node of every template carries nodetectrules, so this can never auto-declare a lanedone. -
Only bytes appended since the last pass are read. On the first sight of a journal only its recent tail is read, and nothing at all when that file is already idle — replaying a thread that finished days ago would paint stages for work nobody is doing. "Idle" means the journal's mtime is more than two minutes old or in the future: a file that claims to be from the future (clock stepped back, NTP correction, a restore that preserved timestamps) makes a raw
now - mtimenegative, which would otherwise read as "written milliseconds ago" and replay a finished thread as live work. -
The same pass mirrors the lane's
statusbetweenidleandrunningfrom the journal's mtime, under the identical guard hook ingestion uses (only a lane with norun_id, and only fromidle/running— never fromprovisioningorfailed). It writes nothing else: notstage, notnotes, notslot/ports.
A codex lane's evidence is a separate matter. Auto-advance moves the ring
but can never supply evidence, so every node a codex lane passes through stays
amber until the session itself runs agenthub stage <node> --evidence "...". AgentHub
cannot inject an instruction into a CLI it merely spawns, so an AGENTS.md in
the working copy is the only lever — agenthub lanes agents install writes the
marker-delimited block for you (see "Installing the QC/gate agents"). Note that
from inside a codex session agenthub stage needs to know which lane it is: a pane
the dashboard started carries AGENTHUB_LANE_ID, and anywhere else --tool codex
disambiguates (see "Which lane a CLI command addresses" below).
The evidence boundary
An inferred stage is never evidence and never renders as done. Green
(done) requires a stage the agent explicitly declared with evidence; an
inference can reach dashed amber at most — visually distinct from both solid
green done and solid amber passed-no-evidence
(client/src/components/lanes/PipelineMap.tsx). This boundary exists because
detection is a guess from tool names and a handful of string fields, not
proof that the agent actually finished the stage — a Bash call matching
npm run test could be a flaky retry, not a passing suite. Treating it as
proof would let a lane's pipeline map lie about what actually happened.
The node the agent declared itself on is never flagged as detected, so it
keeps its blue current ring — including when the declaration came in through
an alias (agenthub stage coding resolves to the implement node, and stages is
keyed by the raw declared word, not the node id). Past nodes get the same
protection: stageRecords (server/lib/pipelines.js) resolves every recorded
key back onto its node, so a stage declared by alias keeps its record — and its
--evidence — instead of reading as an inference or losing its done. Where a
node has both a canonical record and an alias record, the canonical one wins.
The same rule governs agenthub lanes: the inferred stage is printed only when it
leads the declared one (see "Viewing lanes" below), and LaneStripCard.tsx's
detectionLeads shows its badge under the identical condition — the terminal
and the browser never disagree about which one is the headline. Both locate the
declaration by the node the server already resolved it onto (the one whose
state is current), never by looking lane.stage up as a node id: most of
what the ship-feature skill declares is an ALIAS (tests, booting, ship,
gate-blocked), which is not an id, and an id lookup scores it -1 — every
detection, however far behind, would then read as leading.
Which lane a signal is credited to
A hook's cwd is the session's directory, not the directory the command ran
in. Measured on a real install: 325 of 400 events carried the session's cwd
while the edits and test runs happened in another repo reached with
cd <other> && …. The lane doing the work detected nothing; the lane the
terminal started in absorbed all of it.
So resolveLaneForWork (server/lib/lanes.js) prefers a lane named by the
tool's own input — the file_path being edited, an absolute path a command
cds into — and falls back to the session's cwd when the input names no other
lane. Deepest match wins, same rule as resolveLaneByCwd.
Only the stage inference follows the work. session_id and needs_action stay
on the session's own lane, because those really are session-scoped facts: the
session is bound to the directory it started in even while it operates
elsewhere.
What signals are read
server/lib/stage-detect.js inspects every incoming hook's tool_name and
tool_input (touchLaneFromHook in server/routes/hooks.js calls detect()
on each hook). Detection runs ahead of the lane's needs_action/session_id
bookkeeping — that block returns early when there is nothing to patch, so
detection could not live after it — and therefore sits in a try/catch of its
own: a throwing recordDetection (ENOLANE on a lane deleted mid-hook,
SQLITE_BUSY) must never cost the bookkeeping that predates it. Only these
tool_input fields are read — never old_string/new_string or other editor payloads that can
contain whole code blocks:
commandfile_pathskillpromptpatterndescriptionsubagent_type
Each rule is tested against these fields one at a time, never against a join
of them. An Agent event really carries description + prompt +
subagent_type together, so a rule anchored to the agent's identity —
{"tool": "Agent", "match": "^Explore$"} in ship-feature.json — would never
fire against a concatenation of all three, and a rule could otherwise match
across the seam between two unrelated fields. Write anchored rules against the
one field that identifies the tool call.
The signal shown to the user is the span the rule's regex actually matched,
plus 24 characters of context on each side, with an ellipsis marking either end
that was trimmed. A shell line like
cd /home/very/long/path && npm run test:server 2>&1 therefore reports
`…path && npm run test:server 2>&1` rather than the whole command. A rule
with no match fired on the tool name alone and has no span, so it falls back
to the flattened input. Either way the result is capped at 120 characters
(collapsing whitespace first) and stored as detected_signal — this is why a
lane's tooltip sometimes shows a file path or a skill name rather than a shell
command: it's whichever of the fields above the matching rule's tool carried.
Superpowers skill invocations
The built-in default pipeline's intake, plan, implement, review, and
ship nodes each carry a {"tool": "Skill", "match": "..."} rule matching the
workflow skill names they expect (brainstorming, writing-plans,
executing-plans/subagent-driven-development, Claude Code's own
code-review plus requesting-code-review/receiving-code-review,
finishing-a-development-branch). Invoking one of
these skills is a much stronger signal than a matched Bash command, but it is
still detection, not declaration — it renders dashed amber and never done,
same as every other detected stage.
Detection only ever attributes to a lane whose cwd matches the hook's
session cwd (see "Which lane a signal is credited to" above). A session
working directly in a source repo that was never itself adopted as a lane —
run agenthub lanes add --cwd $(pwd) from that repo to fix that — gets no
detection at all, because no lane owns that cwd.
Detection expires
Forward-only would otherwise park a lane at the highest stage it ever touched:
a session that ran the test suite reaches tests and can never show
implement again, even while the agent is back editing code.
So a standing detection holds the forward-only floor only while it is fresh.
Once detected_at is older than DETECTION_TTL_MS (default 300000, i.e. 5
minutes), the comparison against detected_stage is skipped and the new signal
wins regardless of direction. A detected_at that is NULL or unparseable counts
as stale — an unknown age cannot be proven fresh.
Five minutes, not thirty. A session cycles implement → tests → ship → implement
→ tests within one sitting, and a thirty-minute hold pinned the lane at the
furthest stage it ever touched: one push left a lane reading ship while the
agent was demonstrably back to running tests. Five minutes is still far longer
than a burst of tool calls, so the anti-flap property is unaffected.
Two things the expiry deliberately does NOT do:
- It does not weaken declared-wins. An agent's own claim never expires: a
lane declared at
reviewstill refuses animplementdetection, stale standing detection or not. - It does not let inference render
done. Everything in "An inferred stage is never evidence" above still holds. The TTL changes which detection is current, never what a detection is worth.
Set DETECTION_TTL_MS in the server's environment to change the window; it is
read per call, so no restart is needed for a test harness that sets it.
Where the rules live
Detection rules are not code — they live in the pipeline template itself, as
a detect array on each node. The built-in default.json
(server/data/pipelines/default.json) ships these rules today, node by node:
| Node | Detect rules |
|---|---|
intake |
Agent matching subagent Explore — a lane sitting at nothing else yet, but already exploring, shows something instead of idle; Skill matching brainstorming, which is intake's own declared command |
plan |
Skill matching writing-plans; Write matching docs/.*plan.*\.md; Agent matching Plan|Software Architect|Backend Architect|UX Architect; TaskCreate (any) |
implement |
Skill matching executing-plans|subagent-driven-development|test-driven-development; Edit (any); Write to any path NOT under a docs/ directory (^(?!.*(?:^|/)docs/)) |
tests |
Bash matching \b(npm (run )?test|pytest|vitest|jest|go test|cargo test|node\s+--test|rspec|phpunit|dotnet test|mvn test|gradle test)\b; Agent matching Test Results Analyzer|API Tester|Performance Benchmarker |
review |
Skill matching code-review|requesting-code-review|receiving-code-review; Bash matching \bgh\b[^;&|]*\bpr diff\b; Agent matching a name containing reviewer/Reviewer (excluding senior-gate-reviewer, a lookbehind), Evidence Collector, or Accessibility Auditor |
gate |
Skill matching verification-before-completion; Agent matching senior-gate-reviewer|Reality Checker — entering the gate, never its verdict |
ship |
Bash matching a git push invocation — git, then option groups, then push as the first non-flag token — or gh … pr create |
done |
none — see below |
git diff is deliberately NOT a review signal. It was, and measured on a
real session four git diff --stat runs — used to verify a generated file —
outranked 81 test runs and 30 edits and pinned the lane at review, because
detect() takes the LAST matching node and recordDetection is forward-only.
Reading a diff is constant background activity, so it carries no stage
information. gh pr diff stays: that one really is a review act.
The ship pattern matches a git invocation, not the word push. Two
weaker forms were tried and both failed against real commands:
git[^;&|]*push(same shell segment) misses this repo's own push, becausegit -c credential.helper='!f() { … }; f' pushputs a;between the two inside a quoted value. Six real pushes went undetected that way.git[\s\S]*push(anywhere aftergit) over-matches, and did so on a live lane within minutes:git log --oneline -1 && echo "… push …"pinned the lane atship. Sinceshipsits near the end of the pipeline and detection is forward-only, that single over-read stuck — the same failuregit diffcaused forreview.
So the pattern consumes option groups explicitly, treating a quoted option value
as one unit, and then requires push to be the first non-flag token. That
accepts git push, git -c core.hooksPath=/dev/null push and the credential
-helper form, while rejecting git log … "push", git commit -m "don't push",
docker push, and npm run push-docs.
The ship-feature template (server/data/pipelines/ship-feature.json) carries
its own rules, aimed at the commands and Superpowers skills its driving skill
actually runs:
| Node | Detect rules |
|---|---|
intake |
Skill matching brainstorming; Bash matching agenthub … feature activate; Agent matching subagent Explore |
plan |
Skill matching writing-plans; Write matching docs/superpowers/specs/lane-.*\.md; Agent matching Plan|Software Architect; TaskCreate (any) |
implementing |
Skill matching test-driven-development|executing-plans|subagent-driven-development|systematic-debugging; Edit/Write to any path NOT under docs/superpowers/specs/ (resp. not under docs/) |
gates |
Bash matching agenthub … hook ci-gate or agenthub … sync-base --check |
e2e-feature |
Bash matching agenthub … up --qc or agenthub … hook e2e |
review |
Skill matching code-review|requesting-code-review|receiving-code-review; Agent matching a name containing reviewer/Reviewer (excluding senior-gate-reviewer, a lookbehind) |
qc |
Agent matching qc-local|Evidence Collector|Accessibility Auditor; Bash matching agenthub … lanes proof-link |
gate |
Agent matching senior-gate-reviewer|Reality Checker; Skill matching verification-before-completion |
publishing |
Skill matching finishing-a-development-branch; Bash matching a git push invocation (the same pattern default.json's ship uses) |
pr-open |
Bash matching gh … pr create |
watching-pr |
Bash matching gh … pr view |
e2e-feature-passed, qc-plan, reported, merged, done |
none — declaration-only |
Two rules are deliberately absent from this template. There is no git diff
rule on review, for the reason the default template learned the hard way
below; the code-review skill invocation is the honest signal. And merged /
done carry no rule at all, because inference must never reach a terminal
state — a test pins that.
Detection here is a safety net, not the mechanism: the ship-feature-lane
skill declares every one of these stages with agenthub stage itself. What
detection adds is the stage an agent forgot after a context compaction, the
heartbeat that keeps a working lane from reading STALLED, and coverage for a
lane running Superpowers skills without the driving skill at all. It cannot
substitute for the skill's own declarations: because recordDetection is
forward-only AND never overrides a higher declared stage, a fix-loop re-entry
that drops back to gates is invisible to detection — only the skill's
agenthub stage gates moves the lane back down.
done in default.json deliberately has no rule — it is explicitly out of
scope for inference (see the task's "Out of scope" list): done is the one
state detection must never reach on its own, since inferring it would let a
heuristic assert an outcome instead of observing activity. intake and gate
now carry entry-activity rules (an Explore agent, a senior-gate-reviewer/
Reality Checker agent or verification-before-completion skill) — these
detect that the activity of exploring or gate-reviewing started, never a
gate's pass/fail verdict, so the "no outcome inference" rule still holds.
To add a rule, drop a template into the directory named by the
DASHBOARD_PIPELINES_DIR environment variable (see "Custom pipeline
templates" above) with a detect array on the node you want to match:
{ "id": "implement", "label": "implement", "detect": [
{ "tool": "Bash", "match": "docker build" }
] }
match is a JavaScript regular expression tested against the flattened
tool_input string; omit match entirely to match on tool name alone. An
invalid regex is skipped rather than blocking hook ingestion.
Forward-only, write-on-change
Detection never rewinds a lane and never fights a declaration:
- Forward-only. A detection only overwrites
detected_stagewhen its node index is strictly greater than the currentdetected_stage's index — reading a file after editing it must not drag a lane back toplan. - Declared beats detected. A detection is written only when the lane's
declared stage index is strictly less than the detection's. A lane
already declared at
reviewignores animplementdetection outright. One exception: a declaration on the pipeline's LAST node (done, in both built-in templates) stops vetoing. The pipeline is finished there, so a later detection is new work rather than a stale rerun of what the claim covers — without the exception a lane left atdonerejects every detection for the rest of its life, which reads as "auto-detect is broken". The exception changes nothing else: the detection still only paints the amber badge, andlanes.stagestill saysdoneuntil an agent declares otherwise. - Write-on-change only. The database write (and the
lane_updateWebSocket broadcast) happens only whenrecordDetectionreports an actual change. A real install saw 29,470Bashevents alone from one project — writing to the DB and broadcasting on every matching hook, rather than only on a genuine advance, would turn routine ingestion into a DB write and a WS frame per tool call.
Detection writes only detected_stage, detected_signal, and detected_at
(server/lib/lanes.js's recordDetection) — it never writes lanes.stage,
the declared field. The agent's own declaration is the only path to a stage
being recorded as done.
Liveness: detecting dead lanes
The dashboard watches for silent sessions using two rules:
The liveness rule
A lane's liveness state (shown as active, idle, or dead) depends on:
- Lane status (
running,idle,provisioning) - Stage name (does it match
watch|pollregex?) - Age (how long since the last event?)
Idle lanes are never dead. If a lane's status is idle, it's at rest by design — no session is expected to be running. A session might connect later.
Watching sessions die after silence. When a lane's stage matches the pattern /watch|poll/i (e.g., stage watch-for-updates), the session is expected to emit heartbeat events. If it goes silent for longer than LANE_DEAD_SEC (default 300 seconds), the dashboard marks it as dead. A watcher with no events is a dead process; an idle session with no events is just idle.
Configuring the timeout
Set the environment variable to change when a watcher is considered dead:
export LANE_DEAD_SEC=600 # 10 minutes instead of 5
Housekeeping: agenthub lanes gc
Runs machine-wide, not against one lane — safe to run any time, running lanes and live sessions are unaffected:
agenthub lanes gc [--dry-run]
Two things, both scoped to what's actually stale:
- Reaps orphaned Playwright MCP processes. A
.playwright-mcp-scoped process whose owning Claude Code session died gets reparented to pid 1 — a live session's MCP keeps its real parent and is left alone. Kills the whole process tree so a spawned browser doesn't leak too. - Caps oversized hook logs. Any
LANES_ROOT/.state/lane<N>/logs/*.logover 10MB is truncated in place to its last 2MB (same inode — a concurrent writer's file descriptor stays valid).
--dry-run prints what would happen without doing it. This is a deliberately narrower port of Shipyard's lane-gc.sh — it does NOT auto-remove stale worktrees by age (that would violate this repo's own never-automatic-destroy rule; use agenthub lanes reset|remove|purge explicitly instead), archive feature state (AgentHub's lane/feature state lives in the database, not flat files), or sweep scratch debris (AgentHub doesn't generate the files Shipyard's own scripts did). See docs/superpowers/specs/2026-08-05-lane-gc-design.md for the full scoping rationale.
Lane actions
The web UI and CLI provide these actions on a lane:
start
Start a tmux-backed run attached to the lane. The Workspace page's "Start Run" button calls POST /api/run with the lane's id; you can also attach from a real terminal using agenthub lanes shell.
curl -X POST http://localhost:4820/api/run \
-H "Content-Type: application/json" \
-d '{"laneId": 5, "initialPrompt": "continue the work"}'
The initialPrompt field is optional — if omitted, the tmux session is created/attached with no initial input, and you type into the terminal directly. Returns { id, laneId, status, cwd, model, permissionMode, effort, resumeSessionId, sessionId, startedAt, promptPreview } where id is the tmux session name. The same tmux session persists across attach/detach cycles, so you can switch between the browser Workspace and agenthub lanes shell seamlessly.
Permission mode in a lane run. permissionMode (one of acceptEdits — the default — default, plan, bypassPermissions) sets the mode the pane starts in. The pane's claude also gets --allow-dangerously-skip-permissions, which puts bypass permissions into the pane's own shift+tab cycle without enabling it — matching what you get in a real terminal, where the cycle would otherwise be limited to plan / auto / manual / accept-edits and bypass would be unreachable from inside a dashboard-started run. Bypass is still only ever entered by an explicit shift+tab in the pane or by asking for permissionMode: "bypassPermissions" up front; nothing skips permission checks by default.
A killed run releases the lane. When the tmux session is terminated (from the terminal, browser stop button, or external kill), the lane's run_id is cleared, its status returns to idle, and the change is broadcast as lane_update. Runs are recorded with the lane's id and are listable via GET /api/run/history?laneId=<n>.
stop
Terminate the running session. If the lane has no live run, this is a no-op (no error).
curl -X POST http://localhost:4820/api/lanes/5/stop
clear
Reset the lane's pipeline progress, stages, notes, and inferred stage. The lane itself persists; only its recorded history is cleared.
curl -X POST http://localhost:4820/api/lanes/5/clear
remove
Delete the dashboard's record of the lane, including its recorded history. The working tree, its branch and its database are left untouched. Requires confirmation (confirm: true):
curl -X POST http://localhost:4820/api/lanes/5/remove \
-H "Content-Type: application/json" \
-d '{"confirm": true}'
Actions gated behind confirmation: remove requires the confirm flag to prevent accidentally dropping a lane's record. It deletes that record only — never the worktree, the branch or the database.
Proof gallery
A lane's proof gallery is a collection of QC screenshots captured during active work, grouped by feature (the same slug from Per-feature state and archive above) and phase (e.g. desktop, mobile, e2e, visual). A QC agent running an MCP server like playwright-mcp captures screenshots to disk at <lane.cwd>/.playwright-mcp/proof/<slug>/<phase-group>/ and generates an optional ticket report at <slug>/ticket/REPORT.html. The Workspace gallery panel displays these files grouped by feature, using the same feature picker as the per-feature state section.
Storage
Proof files live inside the lane's own cwd, not under LANES_ROOT:
<lane.cwd>/.playwright-mcp/proof/
├── auth-redesign/
│ ├── desktop/
│ │ ├── 01-login.png
│ │ └── 02-signup.png
│ ├── mobile/
│ │ ├── 01-login.png
│ │ └── 02-signup.png
│ └── ticket/
│ └── REPORT.html
├── another-feature/
│ ├── e2e/
│ │ └── 01-user-flow.png
│ └── ticket/
│ └── REPORT.html
└── …
Linking proof directories (the ensure_proof_link primitive)
An MCP server's --output-dir flag may point to different locations across runs. To converge all proof onto one canonical path regardless, AgentHub provides the ensure_proof_link operation, exposed only as the explicit agenthub lanes proof-link CLI command — it is never automatic. This matches the "AgentHub does not orchestrate" rule: a session decides when to link, not the dashboard.
ensure_proof_link works as follows:
- If a stray
proof/directory exists at<lane.cwd>/proof, merge its contents into the canonical.playwright-mcp/proof(no-clobber — existing files are never overwritten) and replace it with a symlink. - If a
proof/symlink already points to.playwright-mcp/proof, the operation is a no-op. - If a file named
proofexists (neither directory nor symlink), it is left untouched to avoid clobbering a user's file.
The operation is idempotent and always safe — running it multiple times on the same lane has no side effects.
Security
Every path the proof module touches — reading, serving, or deleting files — is resolved, realpath'd, and checked to be inside the lane's proof root before any filesystem operation. Symlink escapes, path traversal (../), and bad characters (/, \, .. in segment names) are all rejected with EBADPATH errors. deleteProof never removes the ticket/ directory, only the phase-group subdirectories and their images, so a lane's ticket report persists even when phase proofs are pruned.
Gallery panel and feature selection
The Workspace page's gallery panel reuses the feature picker from Per-feature state and archive — there is only one selector, not a separate one for proofs. Selecting a feature displays that feature's saved pipeline (from per-feature state) and its proof gallery (if any proofs exist for that feature).
Cross-lane named locks
Cross-lane named locks serialize work that thrashes a shared machine — builds, e2e runs, database migrations — across all lanes, not just within one lane. This is a separate axis from withLaneLock, the in-process per-lane lock in server/lib/lane-lock.js: lane-lock is about when a lane runs internal operations; named-lock is about which other lanes must wait.
How they work
- Atomicity via
mkdir. Lock ownership is declared via anownermarker file insideLANES_ROOT/.locks/<lock-name>/.mkdiratomically creates the lock directory or fails withEEXIST— no race between check and create. - Owner file format:
<holder> <acquired-epoch-seconds>— the holder identity (defaults tolane<slot>for the calling lane) and a Unix seconds timestamp. When a new acquire finds the directory already exists but the holder is stale (older thanLOCK_MAX_HOLDseconds, default 2700s / 45 minutes), the old holder is considered dead, its directory is removed, and the acquire is retried once before answering. - The
LOCK_MAX_HOLDfloor. The default is 2700 seconds, but it has a hard floor of 300 seconds. No caller can force-break a live holder by settingLOCK_MAX_HOLD=1— the floor prevents that mistake. The lowest possible break threshold is 300 seconds, even ifLOCK_MAX_HOLDis overridden to something smaller. - Waiting and polling.
agenthub lock acquireblocks the calling lane (polling the server every ~2 seconds via a single-shotPOST /:name/acquire— the server itself never blocks or queues) until the lock is free or--timeoutexpires. While waiting, it prints a status line every ~60 seconds, so a long wait reads as "still waiting", not a hung command — this is terminal output for whoever is watching, not a dashboard liveness signal.
The CLI
agenthub lock status [<name>]
Show one named lock's current holder, or every currently-held lock. <name> is optional — without it, lists all locks.
agenthub lock acquire <name> [--holder X] [--timeout N]
Acquire a cross-lane named lock, polling until it is free or the timeout expires. --holder defaults to lane<slot> (the calling lane's identifier based on its slot). --timeout is in seconds; without it, the command waits indefinitely.
agenthub lock release <name> [--holder X]
Release a lock. Refused with status 409 if the --holder does not match the current owner. The --holder default is the same as acquire: lane<slot>.
The lane card
The lane card shows a lock badge when the lane holds a named lock (its lane<slot> identity matches a held lock's holder) — polled every 30 seconds, the same interval as git and runtime facts. There is no server-side concept of "who is waiting" to display; only who currently holds.
Etiquette
Waiting is normal. A lane that sits at a lock for a few minutes while another finishes a build is expected behavior, not a failure. Do not interrupt or force-break a lock.
- Never kill a holder. If a lane is stuck holding a lock, do not kill the process or the dashboard. Investigate why the holder is not releasing it.
- Never delete the lock directory by hand. A lock that outlives its holder (e.g. after a hard reboot) is cleaned up automatically — the next
acquireon that name finds it stale (older thanLOCK_MAX_HOLD) and breaks it. DeletingLANES_ROOT/.locks/<name>/yourself only races whoever else'sacquireis about to do the same check safely. - Never shrink
LOCK_MAX_HOLDto force through a wait. The 300-second floor exists specifically to stop this mistake. If the true holder is gone, the 300-second minimum wait is the price of safety. If the true holder is still running (e.g., a build with a network stall), shortening the timeout from 2700 to 300 does not help — it converts a slow success into a premature timeout, leaving the lock held and every other lane blocked forever.
The ship-feature-lane skill (E1)
The ship-feature-lane skill is the ported Shipyard driving skill for autonomous end-to-end feature pipelines in a single AgentHub lane. It coordinates the entire development flow: implementation (TDD) → independent unit tests → pre-push CI gates + dev preflight → e2e testing → code review → local QC → senior gate authorization → PR push and publication → CI watch → final report.
Every stage whose job is to judge the work runs in a fresh-context subagent, never in the driving session. The plan debate (Stage 0b), unit tests (Stage 1b), the e2e run and its triage (Stage 3), code review (Stage 4), browser QC (Stage 6), the senior gate (Stage 7), and a re-triage of CI that stayed red after a fix (Stage 10) are each dispatched with the Agent tool to a subagent that starts with an empty context and receives only artifacts it can verify itself — working directory, lane spec, diff range, commands, and the other agents' reports verbatim, never the driving session's paraphrase of why a finding was fine. The stages the driving session keeps are the ones that do rather than judge: intake, implementation, the mechanical gates, publishing, the CI/PR watch, and applying every fix the judges ask for. subagent_type: fork is explicitly forbidden for these: a fork inherits the implementing session's context, so it inherits the belief that the code is already correct. The driving session implements and applies fixes; it never grades its own work. Stages 1b/3 use the generic general-purpose type (nothing to install). Stage 4 uses the generic Code Reviewer type as its catch-all, plus — in parallel, routed by which of server/, client/ the diff touches — the plugin-qualified agenthub:backend-reviewer / agenthub:frontend-reviewer domain reviewers (nothing to install; agenthub: addressing works from any lane). Stages 6/7 use the lane-installed qc-local/senior-gate-reviewer agents.
Getting the skill (nothing to do, if you run the plugin)
The skill lives in skills/ship-feature-lane/, and the repo root is the agenthub plugin root ("source": "./"), so skills/ is the plugin's own skills directory. Anyone with the agenthub plugin installed already has it in every session, from any lane's working directory, as /agenthub:ship-feature-lane — with the bare /ship-feature-lane working as an alias unless another skill or command claims that name.
Only a plain checkout without the plugin needs the fallback:
agenthub skills install
Copies skills/ship-feature-lane/ into ~/.claude/skills/ship-feature-lane/ (overwrites on reinstall — run it again after pulling an update to the skill), which restores the bare /ship-feature-lane name. One-time per machine, same as agenthub lanes agents install is one-time per lane.
Agents come from the same plugin, under two names. qc-local and senior-gate-reviewer live in agents/ at the repo root, so the plugin exposes them as agenthub:qc-local / agenthub:senior-gate-reviewer. agenthub lanes agents install copies those same files into the lane's own .claude/agents/ — the highest-priority agent source — which is what makes the bare subagent_type: qc-local the skill prefers resolve inside the lane. Either name reaches the same definition; the skill falls back to the agenthub: form when the lane copy is missing.
Invoking the skill
# Inside a lane's working directory:
/ship-feature-lane <requirement>
The skill frontloads all clarifying questions once, then runs unattended. The only interactive touchpoints are Stage 0 (Q&A intake) and merging the PR on GitHub; everything else runs to completion or escalates with a blocked status visible on the dashboard. Progress is declared via agenthub stage commands at every step.
Current status: stages 0–8, 10–12, 14 work; stage 9 deferred, stage 13 partially wired (CI-wait works, dev-QC doesn't); stages 6–7 agent-gated
Stages implemented now:
- 0-8: Intake & frontloaded Q&A → plan → implementation → independent unit tests (1b) → gates+preflight → e2e on feature branch → code review → QC plan → QC → senior gate → publish PR
- 10-12: CI watch on the PR → report → watch PR until merge (gated fix-loop re-entries on review feedback)
- 14: Done
Stages currently hardcoded skipped (pending F's integrations):
- 9 (Ticket): Ticket-filing integration not yet built — this stage is skipped entirely.
Partially wired:
- 13 (Post-merge verification): CI-wait half now runs for real via
agenthub lanes ci status. The dev-QC half (QCing the deployed site) is still unavailable — Stage 13 always ends noting that gap even when CI-wait passes clean.
Stages 6 and 7 are now unblocked — run agenthub lanes agents install once per lane (see "Installing the QC/gate agents" below) before a lane's first run through Stage 6. A lane that reaches Stage 6/7 without having installed the agents will fail to find the qc-local/senior-gate-reviewer subagent type; install and re-run.
See the skill text for the full pipeline definition.
QC boot flag and profile integration
When the lane stack needs to run under QC conditions (deterministic, mocked externals), use the --qc flag:
agenthub lanes up --qc
This flag activates the lane's QC_BOOT_ENV profile declaration. Define it in the profile's profile.env file as space-separated KEY=value pairs (the same format as the PORTS declaration):
# .agenthub/profile/profile.env
PORTS="app"
PORT_BASE_app=3000
QC_BOOT_ENV="MOCK_PAYMENTS=1 STUB_EMAIL=1"
These environment variables are passed to the profile's boot hook during agenthub lanes up --qc, ensuring QC test runs are deterministic.
Dev preflight and merge safety: sync-base
agenthub lanes sync-base is the ONE sanctioned merge in the pipeline — origin/development into a feature branch — used at Stages 2, 8, and 12. Three modes:
agenthub lanes sync-base --check feat/<slug> # read-only preflight: fetch + collision check + DEV_DELTA/DEV_OVERLAP
agenthub lanes sync-base feat/<slug> # merge origin/development into the feature branch
agenthub lanes sync-base --continue feat/<slug> # finish after a manually resolved conflict
Exit codes: 0 clean, 4 merge conflict (left in place — resolve, commit, then --continue), 5 migration-number collision (nothing merged — rename the printed file, re-run).
Two profile declarations control it, both empty (off) by default:
# .agenthub/profile/profile.env
MIGRATIONS_DIR="db/migrations"
GENERATED_MERGE_PATHS="api/openapi.json api/client.ts"
MIGRATIONS_DIR enables the collision preflight against a numbered-migrations directory. GENERATED_MERGE_PATHS gives the listed files a keep-ours merge driver (never hand-merged) and folds the profile's regen hook output into the sync commit — the single most common cross-lane conflict, for a repo that generates an API contract/client.
Installing the QC/gate agents: agents install
Stage 6 (browser QC) and Stage 7 (senior GO/NO-GO gate) run as subagents — qc-local and senior-gate-reviewer. The plugin already ships them as agenthub:qc-local / agenthub:senior-gate-reviewer; installing them into the lane's own .claude/agents/ is what makes the bare names work there:
agenthub lanes agents install
Writes both agent definitions (from the repo's own agents/, the same files the plugin ships) into <lane>/.claude/agents/ and adds that directory to the lane's local .git/info/exclude (never the tracked .gitignore — this is a per-clone runtime concern, not an app-repo change). Idempotent and never automatic, the same shape as agenthub lanes proof-link — a session installs the agents explicitly, once, before a lane's first run through Stage 6/7 (or after a AgentHub upgrade ships updated templates — reinstalling overwrites, it doesn't merge).
On a codex lane the same command installs something else. Codex never
reads .claude/agents/, so copying agent definitions there would be dead
files. Instead it writes the stage-declaration block into
<lane>/AGENTS.md — the project doc Codex does load from the working
directory — delimited by <!-- agenthub:stage:start --> / <!-- agenthub:stage:end -->
so a reinstall replaces exactly that block and nothing else. The file is
appended to when it already exists (your own prose is preserved) and created
when it does not; installed comes back as ["AGENTS.md"]. This is the lever
that gets a codex session to supply the evidence auto-advance cannot — see
"Stage detection".
Credentials are not embedded. Unlike Shipyard's original per-lane agent generation, these templates carry no QA account credentials — this repo has no seeded-QA-account system yet. qc-local degrades gracefully: if it hits a login page with no credentials block present, it reports LOCAL-QC: FAIL — login required, no seed-account mechanism configured for this profile rather than guessing.
ticketer, dev-qc, and pr-reviewer are not ported yet — ticketer is invoked by Stage 9 (skipped), and dev-qc by Stage 13's dev-QC half (unavailable); pr-reviewer isn't referenced anywhere in this skill's text.
Syncing MCP servers: mcp sync
A lane needs the same MCP servers (Playwright, a local-QC server) as its source repo to run Stage 3/6. agenthub lanes mcp sync gives it those:
agenthub lanes mcp sync
Reads the source repo's already-configured mcpServers from ~/.claude.json (normal Claude Code project-scope config — set this up for the source repo once, the same way you would for any project), relocates any absolute path under the source repo to the lane's own directory, pins a @playwright/mcp server's --output-dir to the lane's .playwright-mcp (so proof screenshots land where the proof gallery reads them), and writes <lane>/.mcp.json. Also seeds the lane's Chromium browser profiles from the source repo's own — preserves saved logins, and never overwrites a profile that already exists at the destination.
No permission/settings changes. Unlike Shipyard's original lane-mcp-sync.sh, this command never writes to <lane>/.claude/settings.local.json — no auto-approval rules, no autoMode bypass entries. A session's gh/git push commands go through the normal permission prompt like any other command.
A lane whose source repo has no mcpServers configured gets a clear ENOMCPCONFIG error, not a silently-empty .mcp.json — configure the source repo's MCP servers first, then re-run.
Restart the lane's Claude session after syncing — MCP config is read at session start.
Checking integration toggles: agenthub lanes integration
A profile can declare .agenthub/profile/integrations.env with TRACKER_ENABLED, DEV_QC_ENABLED, CI_WAIT_ENABLED flags (all off by default — see profiles/_template/integrations.env-style declarations in a profile's own docs). Check one:
agenthub lanes integration tracker # exit 0 = on, 1 = off
This only reports what the PROFILE wants — it doesn't file a ticket, run dev-QC, or wait on CI. The agent that would act on an enabled dev_qc toggle isn't built yet, and neither is a tracker ticketer — ship-feature-lane's Stage 9 stays skipped and Stage 13's dev-QC half stays unavailable regardless of what those two toggles read. ci_wait's consumer is agenthub lanes ci status (added — see the command reference below); Stage 13's CI-wait half now honors it for real. The CLI command and GET /api/lanes/:id/integrations/:name are the only readouts: the lane card used to carry a row of three badges for these, and it no longer does — two of the three could never be anything but decoration, and a badge that reports a toggle nothing acts on costs a row of card height to say nothing.
Post-merge CI status: agenthub lanes ci status
Check GitHub Actions status for a commit SHA or branch ref — used by Stage 13's CI-wait loop:
agenthub lanes ci status <branch-or-sha> [<id>]
Exit codes: 0 = all checks passed, 1 = at least one check failed, 3 = checks pending or in progress. The <id> parameter is optional and filters results to a specific lane if provided; if omitted, it's not needed.
Pipeline template: ship-feature (16 node stages)
The skill uses the ship-feature pipeline template, which defines the following 16 stages (node IDs):
- intake — frontloaded Q&A and feature activation
- plan — investigation and plan debate
- implementing — TDD implementation
- gates — CI gates + preflight check
- e2e-feature — run e2e on feature branch
- e2e-feature-passed — e2e result gate
- review — code review
- qc-plan — bound QC scope
- qc — browser QC (agent-gated until qc-local lands)
- gate — senior GO/NO-GO gate (agent-gated until senior-gate-reviewer lands)
- publishing — push branch + open/update PR
- pr-open — PR open and published
- reported — report posted
- watching-pr — watch for comments, conflicts, merge
- merged — PR merged, post-verify transition
- done — pipeline complete
The Workspace page (/run) displays this template with nodes rendered in five states: failed (rejected), current (now), done (with evidence), passed-no-evidence (claimed or skipped), and pending (not reached).
More stage names than nodes
Each node carries aliases, and they do two different jobs. Some absorb a
near-miss (implement for implementing). Others are sub-states: a name
the skill declares to say why the lane is sitting on a node, without adding a
node to the map.
This is the shape Shipyard converged on — its dashboard renders 13 nodes while
its PHASES table folds roughly 35 stage names onto them. A pipeline map is
read at a glance across many lanes at once, so it stays coarse; the stage name
is read one lane at a time, so it can be specific.
| Node | Near-miss aliases | Sub-states the skill declares |
|---|---|---|
intake |
assigned, claimed, start |
bootstrapping |
plan |
planning, brainstorm, design |
— |
implementing |
implement, coding, build |
— |
gates |
pre-push-gate, tests |
migration-collision, sync-conflict |
e2e-feature |
e2e, live |
booting, e2e-scoped |
e2e-feature-passed |
e2e-passed |
— |
review |
reviewing, code-review, self-review |
— |
qc-plan |
— | — |
qc |
— | — |
gate |
sr-gate, verify, verification |
gate-blocked |
publishing |
push |
— |
pr-open |
ship, pr, push-conflict |
push-revalidate |
reported |
— | — |
watching-pr |
— | pr-comment-fix |
merged |
— | — |
done |
complete, completed |
— |
50 names over 16 nodes. Every one of them has a source: the skill declares
it, or default.json uses it (an agent moving between pipelines will type
what the other one taught it), or Shipyard's PHASES lists it. An alias with
no source is not "flexibility" — it is a synonym someone imagined, and the
agenthub stage warning already catches a name that resolves to nothing, which is
better feedback than silently absorbing every plausible spelling. Twelve
sourceless aliases were written and then cut for exactly this reason.
Two constraints on this:
- No alias may collide with another node's id or alias.
phaseIdxtakes the FIRST match, so a duplicate would silently resolve a declaration onto the wrong node. A test asserts the whole template is collision-free. - Aliases of one node share one record slot.
lane.stagesis keyed by the declared string, andstageRecordsresolves each key onto its node — so declaringmigration-collisionand thengatesleaves ONE record for that node (the canonicalgatesone wins). A sub-state that needs to keep its own--evidenceseparately has to be a real node, not an alias.
integrate, dev-gates, e2e-on-dev and push-dev are deliberately not
nodes here. Shipyard had them and retired them on 2026-07-16 (see the comment
above PHASES in its dashboard/src/lib/constants.js); it now folds those
names into the surviving phases so old feature cards still render. AgentHub never
shipped them, so there is nothing to fold.
These nodes also carry detect rules; see "Stage detection → Where the rules live".
Orchestration: what AgentHub does NOT do
AgentHub does not chain, queue, retry, or evaluate gates.
The driving Claude Code session is in control. Here's what that means:
- No automatic chaining: The lane doesn't automatically move from one stage to the next. A skill declares the stage explicitly with
agenthub stage. - No queue: There is no work queue. When you run a session, it runs immediately; no waiting for dependencies or prior stages.
- No retry logic: If a stage fails (marked with
--result fail), the lane stays at that stage. The next session must be told to reattempt it (the skill logic decides). - No gate evaluation: A gate stage (marked
gate: truein the template) doesn't block the UI, stop a session, or prevent a transition. It's just a visual marker. The skill must check the gate condition and decide whether to proceed.
Example: In a feature pipeline, if the tests stage is a gate, and tests fail:
- A skill calls
agenthub stage tests --result fail --evidence "5 tests failing" - The UI shows
testsin red (failed state) - The next session runs and a human/skill must explicitly decide: re-run tests, or skip to ship?
- If re-running:
agenthub stage tests --evidence "2 tests still failing" - If skipping:
agenthub stage ship --evidence "manual gate override"
The dashboard shows the history; the driving session makes the decisions.
Known limitations
Lanes page snapshot
The Lanes screen currently shows only the empty state in the dashboard's design. Full design and implementation of the populated view (multiple lanes, interactions, pipeline map) is deferred to a follow-up.
Lane card UI
The lane card UI currently has no prompt/message input field. When you click start, it opens a promptless conversation run in Claude Code (no initial input). The message action exists server-side and via the API but is not exposed in the web UI yet. To send messages, use the API directly or the CLI.
Related commands
agenthub lanes # List all lanes
agenthub lanes add --cwd <path> --title <text> # Adopt an existing directory
agenthub lanes add --repo <path> [--title <text>] [--base <branch>] [--slug <slug>]
agenthub lanes reset|remove|purge <id> [--force] --yes
agenthub stage <stage> [--evidence "..."] # Report the current stage
See also
server/lib/lanes.js— lane storage and lifecycleserver/lib/worktree.js— git worktree creation/reset/removal and the three-check destroy guardserver/lib/lane-preflight.js— the read-only preflight facts behind reset/remove/purgeserver/lib/pipelines.js— pipeline templates and node state derivationserver/lib/stage-detect.js— the stage-detection matcher, field allowlist, and signal capserver/routes/lanes.js— REST API surfacebin/agenthub.js— CLI commands for lanes and stage reportingserver/routes/hooks.js— hook-to-lane binding by cwd, and where detection is invoked