# Workflow: Continuous agent loop

Plan → act → observe → tape → decide. A budgeted loop for shipping work with MCP tools in Cursor.

## Prerequisites

- Editor: [Cursor referral](https://cursor.com/referral?code=BVN3MVJH9SDO)
- Models: [cheaperllm API key](https://cheaperllm.com/?utm_source=agentstackkit&utm_medium=site&utm_campaign=hub) and/or [OneAIPass credits](https://oneaipass.com/chat.html?utm_source=agentstackkit&utm_medium=site&utm_campaign=hub)
- MCP: install [mcp-starter](../mcp-starter/) and optionally [anymodl](https://anymodl.com/?utm_source=agentstackkit&utm_medium=site&utm_campaign=hub)
- Prompts: load `01-mission-brief` and `02-tool-discipline` from [prompt-ops](../prompt-ops/)

## Loop

### 1. Plan
Write a mission brief: goal, constraints, success checks, max iterations, max spend (USD or tokens). Refuse to start without numbers.

### 2. Act
Use the smallest tool that advances the goal. Prefer cheap model routes for classify/extract; escalate to strong routes (including Claude via cheaperllm) only for planning and multi-file edits.

### 3. Observe
Read tool results. If empty, error, or off-schema — stop and repair. Do not invent success.

### 4. Tape
Append every tool call + result to `./tapes/run.jsonl` (session-tape). This is the audit log for postmortems.

### 5. Decide
- Success checks met → stop and summarize
- Budget or iteration cap hit → stop and report blockers
- Otherwise → revise plan (one paragraph) and continue

## Stop conditions (hard)

- Missing required env secrets (`env-gate`)
- Write tools requested outside the allowed path
- Spend exceeds the mission brief cap
- Two consecutive schema validation failures

## Domain / ship extension

When the goal includes launching a site:

1. Name candidates via prompt `08-domain-naming`
2. Compare renewals on [Agora Domains](https://agoradomains.com/?utm_source=agentstackkit&utm_medium=site&utm_campaign=hub), [TLD Bazaar](https://tldbazaar.com/?utm_source=agentstackkit&utm_medium=site&utm_campaign=hub), [BareDomains](https://getbaredomains.com/?utm_source=agentstackkit&utm_medium=site&utm_campaign=hub)
3. Run prompt `10-ship-checklist` before deploy

## Related

- Playbook index: https://agentstackkit.com/workflows/#agent-loop
- Catalog: https://agentstackkit.com/api/catalog.json
