Build a development workflow
Take a ticket through questions, a reviewed plan, failing tests and verified code.
Build on test preparation to implement the change, run tests and request a review. Keep its planning files and the shared helpers listed below. Replace workflow.ts and view.ts with this page’s versions. Use a fresh ticket key: a checkpoint cannot be reused with a different graph.
Keep these shared files: branch.ts, workbench.ts, commands.ts, git.ts, ask.ts, loop.types.ts, write-zones.ts, test-attempt.ts, test-check.ts, tests.ts.
Download all files. Extract into a dedicated directory, run npm install, then adapt outpost.config.ts using Installation. The commands below identify the scripts to run.
This lesson reuses the previous lesson’s files, not its saved execution. It defines another graph and needs its own runId: planning runs again. For one path from ticket to implementation, start directly with the development workflow project.
The review verdict belongs to the implementation loop. Save its contract in verdict.ts.
Write the script
Section titled “Write the script”Add these files to the previous example’s directory.
Implement and review the change
Section titled “Implement and review the change”The implementation loop checks the write boundary, runs the tests and asks a reviewer before committing.
Compose the workflow and its checkpoint
Section titled “Compose the workflow and its checkpoint”Compose the tasks and checkpoint, then close the sandbox after each call.
Submit answers and decisions
Section titled “Submit answers and decisions”Your application imports the entry points from run.ts to submit answers and decisions.
Run node main.ts to inspect the next question, pending plan or final summary. Your application renders questions in a form and plan on a review page. Each call rebuilds the same workflow and checkpoint, so it can run in any process on the machine that holds the repository.
Create this entry point to start the workflow and print its state.
Understand the steps
Section titled “Understand the steps”Each check runs in a fixed order, and the first rejection becomes the next round’s feedback:
| Loop | Check, in order | Rejects when |
|---|---|---|
tests | Write zone | No test changed, or a non-test file changed |
tests | Red run: npm test | The tests already pass: they prove nothing |
code | Write zone | A test file changed |
code | Green run: npm test | The tests fail; their output is the feedback |
code | Reviewer agent, defineJsonResponse() | approved is false |
The brief asks agents not to commit. Each loop commits only once every check accepts, so a rejected round leaves its changes for the next attempt to fix. answer() and decide() return after the next agent turns, which can take minutes: from a web request, hand them to a job queue worker.
Adapt the example
Section titled “Adapt the example”| Variation | Change |
|---|---|
| Read the ticket | Add a first defineTask() that fetches the ticket from your tracker and returns { key, text }; read it with context.value() in the briefs instead of the constant. |
| An adversarial reviewer | Pass another agent in the reviewer’s request, such as Claude Code with createClaudeHarness(): a different model misses different things (Choose an agent). |
| Stricter checks | Add a typecheck and a lint to the green run, or a second reviewer that checks the tests fail for the right reason, as redline does. |
| Open a merge request | Once progress() returns branch, push it from the host and open a draft pull request with gh pr create --draft --head, or a merge request with glab mr create --draft. |
| Several repositories | One loop pair per repository, chained with after in dependency order (Change several repositories). |
Limits
Section titled “Limits”- Rejection ends the run: A rejected plan skips delivery and the run ends
rejected. Start a newrunIdwith the owner’s note in the brief. - Malformed plan:
planthrows, and the run fails without asking the agent again. Use a loop task to let the agent fix its own JSON. - Rounds run out: A loop whose last check rejects fails with
LoopTaskExhausted; finished tasks stay in the checkpoint and the branch keeps the committed tests. - Same machine: The repository, its worktrees and the framing conversation must be reachable by the process that answers.
- Interrupted round: After a crash right after a commit, the resumed check finds no change and spends a round. Inspect the branch before you resume.
- Retained work: Framing keeps its worktree on an
outpost/interactive-…branch; clean it up when done.
API: defineInteractiveAgentTask · defineApprovalTask · defineLoopTask · defineAgentTask · defineJsonResponse · createSandbox · LoopTaskExhausted.

