Skip to content

Default Task Loop (Bounded Local Agent Loop)

The single, repeatable loop used for every coding task in this workspace, calibrated to keep autonomy bounded and verifiable.

The 6-step loop

ask  →  plan  →  bounded edit  →  test  →  verifier pass  →  commit

1. Ask (intent capture)

  • State the goal in 1-2 sentences. If unclear, the agent must use the Ask tool before planning.
  • Identify allowed-edit scope (specific files / folders / repos). Anything outside scope requires explicit re-approval.
  • Mark data sensitivity (private_sensitive, internal, low_sensitive).

Outputs: scope statement + sensitivity tag.

2. Plan

  • Plan-mode review of approach. Multiple options weighed only if non-trivial.
  • Mermaid diagram or numbered steps if ≥ 3 distinct edits or files.
  • Verifier criteria written before implementation: how do we know it's done?

Outputs: plan + acceptance criteria.

Trigger to switch to plan mode: ambiguity, > 3 files touched, architectural impact, or unfamiliar territory.

3. Bounded edit

  • Smallest possible code change satisfying the plan.
  • Stay strictly within the scope statement.
  • No "while we're here" cleanups.
  • All risky operations (shell, MCP write, file ops outside scope) require explicit approval.

Outputs: diff confined to declared scope.

4. Test

  • Run existing tests touched by the change; add new ones for new behavior.
  • Lint / type-check what changed.
  • For docs / config / infra changes, do a dry-run or --check equivalent.

Outputs: green test run; any flakes triaged or noted.

5. Verifier pass

  • Invoke /verifier subagent (.cursor/agents/verifier.md).
  • Verifier checks: implementation actually exists; acceptance criteria met; tests truly pass; no obvious gaps.
  • If verifier reports incomplete → return to step 3 with the gap, do not skip.

Outputs: verifier report attached to the task in daily-log.md.

6. Commit

  • Atomic commit message, conventional-commit style:
  • feat:, fix:, refactor:, docs:, test:, chore:, security:.
  • Optional: trigger Bugbot manually with cursor review on PR.
  • Update instrumentation/daily-log.md row: outcome + rework flag (still empty unless rework needed).

Outputs: commit (or staged change ready for PR).

Approval gates

These actions always require an explicit user approval, even with autorun:

  • Any shell command outside the workspace.
  • Any MCP write.
  • Network egress beyond Cursor docs / package managers / GitHub.
  • Edit to anything in the user-only secret store.
  • Edit to .cursor/permissions.json, mcp.json, or governance files.
  • Any agent-credential provisioning step.

Anti-patterns to avoid

  • Multi-file refactors disguised as a "small fix".
  • Skipping verifier "because it's small".
  • Marking task done before tests are green.
  • Editing the same file in two passes when one was possible.
  • Generating a plan after editing.

Success gate for Phase 1

5 consecutive tasks completed through this exact loop, logged in daily-log.md, with verifier reports attached, before adopting any new capability.

Loop diagram

flowchart LR
    Ask[Ask intent + scope] --> Plan[Plan + acceptance criteria]
    Plan --> Edit[Bounded edit]
    Edit --> Test[Tests + lint]
    Test --> Verify[Verifier subagent]
    Verify -- pass --> Commit[Commit]
    Verify -- fail --> Edit
    Commit --> Log[Update daily-log + METRICS]