Skip to content
Stagent
jie-worldstatelabs/harness-webapppublic

End-to-end webapp build flow with a planner / generator / evaluator triangle and sprint-contract loops — operationalizing Anthropic's harness-design patterns.

1
by jie-worldstatelabsupdated Apr 24, 20266 stages4 runs

Run in Claude Code

/stagent:start --flow=cloud://jie-worldstatelabs/harness-webapp <task_description>

Paste in Claude Code and replace <task_description>

Template blueprint

State machine

Loading state machine…

Click any stage above to view its instructions below.

Stagespec

spec.md

inline· interruptible · transitions: approved → sprint-plan

Stage: spec

Runtime config (canonical): workflow.jsonstages.spec

Purpose: Planner. Expand the user's brief into an approved product spec — features, user flows, tech stack, AI integration points, and the success bar — that the downstream sprint-plan subagent can decompose deterministically. Output artifact: write to the absolute path provided in your I/O context Valid results this stage writes: pending (spec drafted, awaiting user approval), approved (user has explicitly confirmed)

<HARD-GATE> Do NOT transition out of this stage until the user explicitly confirms the spec. Write `result: approved` only after they have said so. </HARD-GATE>

This is an interruptible stage — the stop hook allows natural pauses for Q&A.

Step 1 — Initialize the artifact and load context

  1. Read state.md for the current epoch.
  2. Immediately write the artifact at the path shown in your I/O context with result: pending and a placeholder body (e.g. "Spec draft in progress."). This is required so the stop hook knows the stage is in-progress.
  3. Read the optional setup_context run_file at the absolute path shown in your I/O context. It contains the original brief / mode hint. If it is empty or {}, treat the brief as missing and ask the user.

Step 2 — Interview the user (planner mode)

You are the Planner in a Planner→Generator→Evaluator triangle. Your single artifact must contain enough signal that the Generator (sprint-build) and the Evaluator (sprint-eval, final-eval) can do their jobs without re-interviewing the user.

If the brief is thin, ask up to 5 short clarifying questions, one at a time. Useful axes:

  • Product: what does the webapp do, for whom, what's the single most important user journey?
  • Tech stack: any constraints (framework, language, database, auth provider, deployment target)? If none, propose a reasonable default.
  • AI integration: which features call an LLM / model? What's the model, what's the prompt contract?
  • Success bar: what does "done" look like end-to-end? Performance budget? Accessibility level? Browser matrix?
  • Out of scope: anything explicitly excluded?

Stop asking once you can draft a coherent spec.

Step 3 — Draft the spec

Present the spec to the user. Then iterate until they explicitly approve. Suggested shape:

markdown
# Product Spec — <Working title>

## Problem & Outcome
<1-2 sentences — who is this for, what changes for them>

## Tech Stack
- Frontend: <framework / language>
- Backend: <runtime / framework>
- Data: <database, file storage>
- AI: <model(s), where they're called from>
- Deployment: <target>

## Features (must-have)
1. <feature> — <one-line description>
2. ...

## Features (nice-to-have)
- <feature>

## User Flows
1. <flow name>: <step → step → step>
2. ...

## AI Integration Points
- <feature> → <model> → <prompt contract / output schema>

## Success Bar (drives final-eval)
- Functional: <every must-have feature works end-to-end>
- Performance: <e.g. p95 page load < 2s>
- Accessibility: <e.g. WCAG AA on primary flows>
- Browser/device matrix: <list>

## Out of Scope
- <explicit exclusions>

Step 4 — Iterate until approved

Ask: "Does this spec look right? Any features, flows, AI points, or success criteria to change?" Iterate until the user explicitly approves.

Each revision: overwrite the artifact body, keep result: pending.

Step 5 — Finalize

Once the user explicitly approves, overwrite the artifact one last time with the final spec body and change the frontmatter to result: approved.

The main loop reads the artifact's result: and calls update-status.sh to advance — do NOT call it yourself from this stage file.

workflow.json· raw config

workflow.json

drives the state machine above