vgpu agent flow
You are the lead. Specialists live in
and run through the
CLI
(root devDependency; call it as
or
). 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
For Blender assets and image-guided visual refinement, use the
asset iteration lane. It pairs an Astra author with declared
Opus 5.5 shader/runtime and critique children, with measured screenshots and evidence-based lessons.
The normal API phases below still apply if the asset work changes a public API.
| Target | Harness / model | Role |
|---|
| fx → Codex | How other frameworks/libraries solve it. Raw findings only |
| fx → Codex | Papers, talks, shipped game techniques. Raw findings only |
| Claude high → Codex high | Eval methodology, independent gates, negative controls, and evidence-based analysis |
| Codex xhigh → Claude xhigh | API alternatives + illustrative snippets, agent-ergonomics evaluation |
| Codex high → Claude high | Plan folder: index, task specs, lanes, progress log |
| Codex high → Claude high | One task, test-first; runs and as children; commits |
| Claude high → Codex high | Docs in house style (called by implementer, or by you for docs-only work) |
| Claude high → Codex high | Read-only review (called by implementer per task, and by you after integration) |
| Codex high → Claude high | Applies a bounded list of integration-review findings |
| Codex high (no fallback) | Blender modeling, renders, environment lighting and AO/lightmap bakes; declares runtime and critic children |
| Claude high (no fallback) | Shaders, browser rendering and parity with Blender; called by asset-author |
| Claude high (no fallback) | Actual capture and cost review, called by asset-author |
| Claude xhigh | One docs gallery example end to end from a brief; sees it running through ; runs ; commits |
| Claude high | Example review: code plus hands-on interaction checks through (called by example-builder) |
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
(kebab-case topic):
text
.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
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
permission lookup if unknown) and the task's origin, then select
(internal work),
(anything originating from an external
issue/PR), or
. Announce the workflow and record it in
:
text
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
(
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 . 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:
sh
npx 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."
Use for API questions and for 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)
sh
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 ) until every decision is settled.
- Write : one numbered section per decision (, , ...) with the chosen option,
the final signatures/defaults/error codes, rejected alternatives with one-line reasons, and
explicit non-goals. Mark it . Only the human can reopen a decision.
Phase 4 — Plan
sh
npx subharness run repo:planner --prompt "Topic: <topic>. Plan the implementation of .context/work/<topic>/decisions.md. Write plan/ under .context/work/<topic>/."
Review
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:
sh
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)
A single-lane plan can run in the current workspace instead.
- Run the lane's tasks in order, one implementer session per task, each lane as its own
background command:
sh
npx 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."
The implementer writes tests first, runs for docs in parallel, runs
(max 2 rounds), commits on the lane branch, and writes .
- After each task, copy the lane's back and update .
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:
sh
npx 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."
Save the output to reviews/integration-<n>.md
.
- Hand blocker/major findings (and cheap polish) to the builder as a numbered list:
sh
npx subharness run repo:builder --prompt "Topic: <topic>. Fix these findings on the current branch: 1. ... 2. ... Verify with: <commands>."
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, follow
.github/guides/pull-requests.md
and .github/pull_request_template.md
against . Build
the description from 's PR record, the key entries, and the
implementers' validation notes; reviewers cannot see . Declare exactly one PR type
( for normal work) and one release impact matching the diff, and run
. For adoption, link the sources and credit the actual contribution; add a
trailer 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>
.
Gallery examples
A new
apps/docs/examples/<slug>
example skips Phases 1–4: write
.context/work/<topic>/briefs/<slug>.md
(idea, quality bar, interactions, constraints, closest
reference examples) and run one builder session per example in the target checkout:
sh
npx subharness run repo:example-builder --prompt "Topic: <topic>. Build the example in .context/work/<topic>/briefs/<slug>.md. Base ref: origin/canary."
The builder carries the example contract in
.subharness/tools/example-playbook.ts
and these tools:
(
.subharness/tools/preview/
) loads
from the checkout's docs dev
server in headless WebGPU Chrome, replays scripted mouse/touch/keyboard input, and returns
screenshots, burst contact sheets, console problems, and GPU/frame timing;
,
, and
(
.subharness/tools/example/
) cover thumbnails, the
pre-commit checklist, and chunk budgets. Two also run from a shell:
node .subharness/tools/preview/cli.ts <slug> --steps '<json>'
and
node .subharness/tools/thumbs/mesa.ts <slug> [--update]
(CI's pinned Mesa renderer).
When several examples are built in sequence, improve the builder between them: ask its session what
context or tooling would have saved time (
subharness send <session-id> --prompt "..."
), evaluate
each suggestion against the next brief and the repository rules, apply the ones that generalize to
the playbook or tools, and log feedback, verdicts, and changes in
.context/work/<topic>/iterations.md
.
Running specialists
Use the agent handoff contract for task assignments, results and
review follow-ups. Keep full evidence on disk, pass compact revision-specific summaries, and use
the executor's receipt to establish which artifacts were actually built or reviewed.
- Prefer one ordinary per specialist through your background-command
controls, continue other work, and collect the result. Otherwise use and later
subharness wait <task-id>
. Never use shell .
- Record the host background-command identifier alongside each task/session identifier. Collect
that command's result and inspect its state; an early response can leave descendant work pending.
Use
wait <task-id> --after <response-id>
to observe later responses. does not configure
a completion notification or guarantee external chat reactivation; that depends on the host.
Continue coordinating the authorized implementation after each result rather than ending at launch.
- Follow up in the same session with
subharness send <session-id> --prompt "..."
; cancel with
subharness cancel <task-id>
. shows live sessions.
- Exit code 0 means a response arrived, not that the goal was met — read the response. A response
with means the specialist paused for a child; follow it with
subharness wait <task-id> --after <response-id>
until .
- Version 0.0.5 returns for supported native permission requests. Inspect
the actual operation, existing user authorization and returned schema; answer only an authorized,
offered choice with
subharness respond <request-id> --content-file <path>
, then observe the same
task. Do not replay the prompt or broaden permissions. Hard sandbox denials remain hard denials.
- In the dashboard, Up/Down selects a run, Enter opens session requests and expands prompt/response
details, and Escape returns. Ctrl+C closes the monitor without stopping agents.
- Check readiness without spending a model turn:
npx subharness check repo:<name>
.
Personal access (per user, not committed)
All vgpu specialists, including Codex/Claude implementations and child writers/reviewers, must use
Vercel project OIDC through AI Gateway so repository work is attributed to the project. Do not
fall back to native subscriptions, direct provider keys, or an unrelated Gateway key. Use the OIDC token of
the
project, configured once in the
main checkout (worktrees read it from
there):
sh
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
may append
/
to
; revert that and add them to
instead. Then create
<main-checkout>/.subharness/agents.local.json
(auto-excluded from Git):
json
{
"access": {
"codex": [{ "type": "vercel-oidc", "project": ".", "envFile": ".env.local" }],
"claudeCode": [{ "type": "vercel-oidc", "project": ".", "envFile": ".env.local" }],
"fx": [{ "type": "vercel-oidc", "project": ".", "envFile": ".env.local" }]
}
}
Verify every role with
pnpm exec subharness check repo:<name>
, including implementation, writer,
reviewer, and both researchers. A readiness check validates startup, not provider quota or a paid
inference result. Never print tokens or commit
/
.
The OIDC token expires after about 12 hours. The lead may renew it for this established project
through the existing authenticated Vercel CLI, following Subharness's
;
children report failures instead of racing to change shared credentials. Do not switch billing
routes when renewal fails. Credential changes apply only to new native sessions: checkpoint and
close older sessions, then start new sessions from those artifacts. A follow-up to an existing
session retains its original credentials. Record which sessions were restarted and the verified
project/expiry, without exposing credentials. The main-checkout access file covers linked worktrees;
a worktree-local copy is not an override.