Cookbook: Agent Workflow
This recipe shows a practical human+agent loop using qp planning, context, validation, and repair.
Scenario
You want agents to make bounded changes with repeatable verification and clear handoff artifacts.
qp.yaml Recipe
project: agent-ready-repo
default: check
scopes:
backend:
desc: Core API + domain logic
paths: [cmd/api/, internal/]
tasks:
lint:
desc: Lint Go source
cmd: golangci-lint run
scope: backend
test:
desc: Run tests
cmd: go test ./...
scope: backend
check:
desc: Main verification command
steps: [lint, test]
scope: backend
guards:
ci:
steps: [check]
agent:
accrue_knowledge: trueHuman Loop
- Stage or edit files.
- Generate a targeted plan:
qp diff-plan- Generate agent handoff:
qp agent-brief --diff --max-tokens 2500
qp context --agent --task check --max-tokens 3000- Ask agent to implement within scope and run verification command.
- If checks fail, run:
qp repair ci --briefPrompt Template
Use the backend scope only.
Implement the requested change.
Run qp check --json.
If it fails, include qp repair ci --brief output and propose next fix.
Summarize changed files and behavior impact.
Why This Works
- Scope constraints keep edits bounded.
agent-briefandcontextreduce prompt ambiguity.checkandguardkeep verification deterministic.repairgives structured follow-up context when failures occur.
CI Companion
tasks:
ci:
desc: CI verification
cmd: qp guard ci --jsonNow local and CI flows share the same contract agents are asked to run.