Autonomous Workflow

The complete loop for AI coding tools: pick up a ticket, implement, push, and move to the next.

Overview

When connected via MCP, AI coding tools follow an autonomous workflow that takes tickets from "ready" to "done" with minimal human intervention. Each step is guided by next_action fields in tool responses.

The workflow loop

1. start_ticket()          → Get next ticket + context + git workflow
2. git checkout -b {branch}
3. get_context(scope: ...) → Only if more context is needed
4. IMPLEMENT THE TICKET
5. git commit
6. complete_ticket()       → Log work + get next_action
7. git push + gh pr create
8. review_milestone()      → When milestone is done
9. LOOP → back to step 1

Step-by-step

1. Start a ticket

Call start_ticket() to get the next ready ticket. This single call:

  • Finds the next ticket by dependency order
  • Sets it to in_progress
  • Returns entity context for the relevant data models
  • Includes learnings from previous tickets
  • Provides git workflow info (branch name, PR title)

2. Create a branch

The git_workflow field tells you the branch name:

git checkout -b feat/m1-backend/01-setup

3. Get additional context (if needed)

If start_ticket() didn't return enough context, use get_context():

get_context(scope: "entities:User+Order,tech_stack")

4. Implement

Build the ticket using the provided file paths, entity schemas, acceptance criteria, and patterns. Commit your work as you go.

5. Complete the ticket

Call complete_ticket() with a summary of what was done:

complete_ticket(
  summary: "Implemented User entity with CRUD API",
  files_created: ["src/models/user.ts", "src/routes/users.ts"],
  files_modified: ["src/app.ts"],
  learnings: [
    { type: "pattern", title: "Prisma model pattern", content: "..." },
    { type: "gotcha", title: "UUID generation", content: "..." }
  ]
)

6. Handle git workflow

The response includes git_workflow and next_action:

{
  "git_workflow": {
    "branch": "feat/m1-backend/01-setup",
    "push": true,
    "create_pr": true,
    "auto_merge": true,
    "pr_title": "feat: Setup backend"
  },
  "next_action": {
    "action": "continue",
    "git_first": true,
    "reason": "3 tickets left. Push, create PR, then continue."
  }
}

When git_first: true:

  1. git push -u origin <branch>
  2. gh pr create --title "<pr_title>"
  3. gh pr merge --auto (if auto_merge is enabled)

7. Review milestone (when prompted)

When all tickets in a milestone are done, call review_milestone(). It analyzes gaps and suggests additional tickets if anything was missed.

Skipping tickets

If a ticket is already done (e.g., infrastructure already exists), skip it:

complete_ticket(skip: true, skip_reason: "Auth already configured")

Handling blockers

If you hit a blocker, use update_ticket with the block action:

update_ticket(
  action: "block",
  reason: "Waiting for database migration",
  blocker_type: "dependency"
)

Learning capture

Learnings saved via complete_ticket() or save_learning()are returned in future start_ticket() calls. This means the AI tool gets smarter about your codebase over time — patterns, gotchas, and conventions are automatically surfaced when relevant.

Project settings

SettingDefaultEffect
auto_merge_enabledtrueAI tool auto-merges PRs after creation
require_testsfalseBlock completion unless test files are in files_created
include_migrationstrueInclude SQL migrations in generated tickets