vgpu agent flow
You are the lead. Specialists live in .subharness/agents/ and run through the subharness CLI
(root devDependency; call it as pnpm exec subharness or npx subharness). You own every
conversation with the human, every decision, every worktree, and every merge. Specialists never
talk to the human and never see this conversation — each prompt must carry the full context.
Team
| Target | Harness / model | Role |
|---|---|---|
repo:api-researcher | fx google/gemini-3.8-flash → Codex gpt-5.6-luna | How other frameworks/libraries solve it. Raw findings only |
repo:graphics-researcher | fx google/gemini-3.8-flash → Codex gpt-5.6-luna | Papers, talks, shipped game techniques. Raw findings only |
repo:api-designer | Codex gpt-6-astra xhigh → Claude claude-opus-5.5 xhigh | API alternatives + illustrative snippets, agent-ergonomics evaluation |
repo:planner | Codex gpt-6-astra high → Claude claude-opus-5.5 high | Plan folder: index, task specs, lanes, progress log |
repo:implementer | Codex gpt-5.6-sol high → Claude claude-opus-5.5 high | One task, test-first; runs writer and reviewer as children; commits |
repo:writer | Claude claude-opus-5.5 high → Codex gpt-5.6-sol high | Docs in house style (called by implementer, or by you for docs-only work) |
repo:reviewer | Claude claude-opus-5.5 high → Codex gpt-6-astra high | Read-only review (called by implementer per task, and by you after integration) |
repo:builder | Codex gpt-5.6-sol high → Claude claude-opus-5.5 high | Applies a bounded list of integration-review findings |
Fallback (→) only happens when the first harness is unavailable before the task starts (missing CLI, no login, no fx Gateway access). A task that fails after starting is never retried elsewhere; re-run it yourself if needed.
Workspace
All pipeline artifacts are gitignored scratch under .context/work/<topic>/ (kebab-case topic):
.context/work/<topic>/
brief.md # you: the problem statement in the human's words + constraints
research/<angle>.md # researchers: raw findings
design/api-options.md # api-designer: alternatives + snippets
decisions.md # you: locked decisions (after human validation)
plan/index.md # planner
plan/tasks/T01-*.md # planner
plan/progress.md # planner creates; you keep it current
plan/progress/T01.md # implementers
reviews/integration-*.md # you: saved integration review output
.context/worktrees/<topic>-<lane>/ # git worktrees for parallel lanes
Never commit .context/.
Phase 0 — Select the repository workflow
Before Phase 1, follow AGENTS.md and .github/guides/workflow-context.md: establish the directing
person's role (run its gh permission lookup if unknown) and the task's origin, then select
maintainer-original (internal work), maintainer-adoption (anything originating from an external
issue/PR), or external-contributor. Announce the workflow and record it in brief.md:
Workflow: maintainer-original | maintainer-adoption
Origin: internal request, or source issue/PR URL + author
Triage: confirmed problem, evidence, disposition
Scope: accepted outcome and non-goals
The phases below implement that workflow's plan and implementation stages; they do not replace its
rules on baseline, changesets, PR delivery, or merge authorization. Every lane branches from a
freshly fetched origin/canary (<base> below) unless the task is a documented production lane.
For adoption, pass the source links to every specialist as evidence and state that the external
implementation must not be copied, cherry-picked, or merged. Stop at the stage the human asked for:
a research or design request ends with findings, a planning request with the plan.
Phase 1 — Research
- Write
brief.md. Split the question into 2–5 independent angles (e.g. "three.js / Babylon API shape", "Bevy / wgpu resource lifetime", "screen-space GI papers 2018–2025"). - Launch one researcher per angle in parallel, each as its own background command:
Usenpx subharness run repo:api-researcher --prompt "Topic: <topic>. Brief: .context/work/<topic>/brief.md. Question: <angle question>. Write .context/work/<topic>/research/<angle-slug>.md."api-researcherfor API questions andgraphics-researcherfor shaders, materials, simulations, and rendering techniques. - Researchers do not conclude. Skim their files yourself only to decide whether an angle needs
a follow-up run (
subharness send <session-id> --prompt "...").
Phase 2 — API design (skip for work with no public API change)
npx subharness run repo:api-designer --prompt "Topic: <topic>. Read brief.md and research/ under .context/work/<topic>/. Design the public API for <problem>. Write design/api-options.md."
Expect 2–4 alternatives; a single recommendation only when one clearly wins.
Phase 3 — Validate with the human and lock decisions
- Present the alternatives to the human: short summary, one key snippet each, trade-offs, the
designer's open decisions, and your recommendation. Use the ask-question tool for each open
decision. Iterate (re-run the designer with feedback via
send) until every decision is settled. - Write
decisions.md: one numbered section per decision (D1,D2, ...) with the chosen option, the final signatures/defaults/error codes, rejected alternatives with one-line reasons, and explicit non-goals. Mark itStatus: locked (<date>). Only the human can reopen a decision.
Phase 4 — Plan
npx subharness run repo:planner --prompt "Topic: <topic>. Plan the implementation of .context/work/<topic>/decisions.md. Write plan/ under .context/work/<topic>/."
Review plan/index.md for lane isolation (disjoint files between lanes) and missing tasks
(docs, changeset, examples, bundle budgets, native GPU tests), and check that its PR record is
self-contained. Show the human the lane summary before starting implementation.
Phase 5 — Implement
For each lane that can start:
- Create an isolated worktree and bring the pipeline folder into it:
A single-lane plan can run in the current workspace instead.git fetch origin canary git worktree add .context/worktrees/<topic>-<lane> -b <topic>/<lane> <base> # <base> = origin/canary mkdir -p .context/worktrees/<topic>-<lane>/.context/work cp -R .context/work/<topic> .context/worktrees/<topic>-<lane>/.context/work/ (cd .context/worktrees/<topic>-<lane> && pnpm install --frozen-lockfile && pnpm build) - Run the lane's tasks in order, one implementer session per task, each lane as its own
background command:
The implementer writes tests first, runsnpx subharness run repo:implementer --cwd .context/worktrees/<topic>-<lane> --prompt "Topic: <topic>. Implement task .context/work/<topic>/plan/tasks/T03-<slug>.md. Base ref: <base>. Governing: .context/work/<topic>/decisions.md."writerfor docs in parallel, runsreviewer(max 2 rounds), commits on the lane branch, and writesplan/progress/<id>.md. - After each task, copy the lane's
plan/progress/<id>.mdback and updateplan/progress.md. Report blocked tasks and disputed findings to the human instead of forcing them through.
Phase 6 — Integrate, review, polish
- Merge lane branches into the feature branch in the plan's integration order; resolve conflicts yourself and run the checks the plan lists after each merge.
- Run your own integration review over the whole branch:
Save the output tonpx subharness run repo:reviewer --prompt "Integration review for <topic>. Base: <base>. Governing: .context/work/<topic>/decisions.md and plan/index.md. Review the full branch diff, focusing on cross-task consistency, public API contract, docs vs code, and release hygiene."reviews/integration-<n>.md. - Hand blocker/major findings (and cheap polish) to the builder as a numbered list:
Re-review if the builder changed behavior. Then summarize to the human: what shipped, checks run, and remaining findings. When the human asks for a PR, follownpx subharness run repo:builder --prompt "Topic: <topic>. Fix these findings on the current branch: 1. ... 2. ... Verify with: <commands>.".github/guides/pull-requests.mdand.github/pull_request_template.mdagainstcanary. Build the description fromplan/index.md's PR record, the keydecisions.mdentries, and the implementers' validation notes; reviewers cannot see.context/. Declare exactly one PR type (developmentfor normal work) and one release impact matching the diff, and runpnpm migrations:check. For adoption, link the sources and credit the actual contribution; add aCo-authored-bytrailer only when verified and warranted. Opening a PR does not authorize merging, closing sources, or releasing. - Remove finished worktrees:
git worktree remove .context/worktrees/<topic>-<lane>.
Running specialists
- Prefer one ordinary
subharness run ...per specialist through your background-command controls, continue other work, and collect the result. Otherwise use--detachand latersubharness wait <task-id>. Never use shell&. - Follow up in the same session with
subharness send <session-id> --prompt "..."; cancel withsubharness cancel <task-id>.subharness dashboardshows live sessions. - Exit code 0 means a response arrived, not that the goal was met — read the response.
- Check readiness without spending a model turn:
npx subharness check repo:<name>.
Personal access (per user, not committed)
Research runs on fx through AI Gateway, which needs an explicit connection. Use the OIDC token of
the vercel-labs/vgpu project, configured once in the main checkout (worktrees read it from
there):
cd <main-checkout>
vercel link --yes --project vgpu --scope vercel-labs # writes .vercel/project.json
vercel env pull .env.local --yes # writes VERCEL_OIDC_TOKEN
vercel link may append .vercel / .env*.local to .gitignore; revert that and add them to
.git/info/exclude instead. Then create <main-checkout>/.subharness/agents.local.json
(auto-excluded from Git):
{
"access": {
"fx": [{ "type": "vercel-oidc", "project": ".", "envFile": ".env.local" }]
}
}
Verify with npx subharness check repo:graphics-researcher. The OIDC token expires after about
12 hours; when fx fails with an expired-token error, re-run vercel env pull .env.local --yes in
the main checkout. Without fx access the researchers fall back to Codex. Codex and Claude Code use
their native subscription logins by default.