|
| 1 | +# ACFS Workflow: Building a New Project |
| 2 | + |
| 3 | +A prescribed sequence of steps and commands for using the Agentic Coding Flywheel Setup (ACFS) to build a new application. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Overview: The Flywheel Loop |
| 8 | + |
| 9 | +ACFS structures development around a compounding loop rather than a linear flow: |
| 10 | + |
| 11 | +``` |
| 12 | +Plan (Beads) --> Coordinate (Agent Mail) --> Execute (NTM + Agents) |
| 13 | + ^ | |
| 14 | + | v |
| 15 | + +---- Remember (CASS Memory) <---- Scan (UBS) + |
| 16 | +``` |
| 17 | + |
| 18 | +Each tool in the chain handles one ring of this loop: |
| 19 | +- **`br`/`bd`** — Plan and track work |
| 20 | +- **`ntm`** — Orchestrate agents |
| 21 | +- **`ubs`** — Guard code quality |
| 22 | +- **`cass`/`cm`** — Preserve memory across sessions |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Phase 1 — Initialize the Project |
| 27 | + |
| 28 | +```bash |
| 29 | +acfs newproj event-management --interactive |
| 30 | +cd /data/projects/event-management |
| 31 | +``` |
| 32 | + |
| 33 | +This scaffolds: `.git/`, `.beads/`, `.claude/`, and a project-specific `AGENTS.md`. |
| 34 | + |
| 35 | +> **Do not skip flags** like `--no-br` or `--no-claude` — they omit essential agent infrastructure. |
| 36 | +
|
| 37 | +Alternative forms: |
| 38 | + |
| 39 | +```bash |
| 40 | +acfs newproj my-project # Non-interactive |
| 41 | +acfs newproj my-project ~/code # Custom directory |
| 42 | +``` |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Phase 2 — Set Up Issue Tracking (Beads) |
| 47 | + |
| 48 | +```bash |
| 49 | +bd init |
| 50 | +git branch beads-sync main |
| 51 | +git push -u origin beads-sync |
| 52 | +bd config set sync.branch beads-sync |
| 53 | +``` |
| 54 | + |
| 55 | +The dedicated `beads-sync` branch prevents worktree conflicts when agents later push Beads state. |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Phase 3 — Create Your Initial Tasks |
| 60 | + |
| 61 | +```bash |
| 62 | +br create "Feature: Event creation and management" --priority=1 |
| 63 | +br create "Feature: Attendee registration" --priority=2 |
| 64 | +br create "Feature: Calendar and scheduling" --priority=3 |
| 65 | +``` |
| 66 | + |
| 67 | +Check what is unblocked at any time: |
| 68 | + |
| 69 | +```bash |
| 70 | +br ready # List tasks with no blockers |
| 71 | +bv --robot-triage # Dependency graph + priority analysis |
| 72 | +``` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Phase 4 — Spawn Agents |
| 77 | + |
| 78 | +```bash |
| 79 | +ntm spawn event-management --cc=2 --cod=1 --gmi=1 |
| 80 | +ntm attach event-management |
| 81 | +``` |
| 82 | + |
| 83 | +### Agent flags |
| 84 | + |
| 85 | +| Flag | Agent | |
| 86 | +|------|-------| |
| 87 | +| `--cc=N` | Claude Code (N instances) | |
| 88 | +| `--cod=N` | Codex CLI | |
| 89 | +| `--gmi=N` | Gemini CLI | |
| 90 | +| `--amp=N` | Amp (reasoning-heavy tasks) | |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## Phase 5 — The Flywheel Loop (During Development) |
| 95 | + |
| 96 | +### 5a. Get context and send to agents |
| 97 | + |
| 98 | +```bash |
| 99 | +cm context "Build event registration system" --json |
| 100 | +ntm send event-management "Let's build the event registration feature. [paste context]" |
| 101 | +``` |
| 102 | + |
| 103 | +### 5b. Track progress |
| 104 | + |
| 105 | +```bash |
| 106 | +br list --status=open |
| 107 | +br update <id> --status=in_progress |
| 108 | +br show <id> |
| 109 | +``` |
| 110 | + |
| 111 | +### 5c. Multi-agent file coordination (via MCP Agent Mail) |
| 112 | + |
| 113 | +Prevents conflicts between agents working on the same files: |
| 114 | + |
| 115 | +``` |
| 116 | +ensure_project(project_key=...) |
| 117 | +register_agent(...) |
| 118 | +file_reservation_paths(..., ["src/**"], exclusive=true) |
| 119 | +send_message(..., thread_id="br-123", subject="[br-123] Starting work", ack_required=true) |
| 120 | +``` |
| 121 | + |
| 122 | +### 5d. Scan staged files before every commit |
| 123 | + |
| 124 | +```bash |
| 125 | +ubs $(git diff --name-only --cached) |
| 126 | +``` |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## Phase 6 — Land the Plane (Session Completion) |
| 131 | + |
| 132 | +This sequence is **mandatory** at the end of every session, in order: |
| 133 | + |
| 134 | +```bash |
| 135 | +# 1. File any remaining work |
| 136 | +br create "Follow-up: Add iCal export" |
| 137 | + |
| 138 | +# 2. Run quality gates (TypeScript/Bun example) |
| 139 | +bun run type-check && bun run lint && bun test |
| 140 | + |
| 141 | +# 3. Close completed issues |
| 142 | +br close <id> --reason "Completed" |
| 143 | +br close <id1> <id2> <id3> # Close multiple at once |
| 144 | + |
| 145 | +# 4. Export Beads state (no git operations) |
| 146 | +br sync --flush-only |
| 147 | + |
| 148 | +# 5. Push everything — work is NOT done until this succeeds |
| 149 | +git pull --rebase |
| 150 | +git add .beads/ src/ |
| 151 | +git commit -m "feat: event registration system" |
| 152 | +git push |
| 153 | +git status # Must show "up to date with origin" |
| 154 | +``` |
| 155 | + |
| 156 | +> **Critical:** Work is **not complete** until `git push` succeeds. Agents that stop before pushing leave work stranded locally. |
| 157 | +
|
| 158 | +--- |
| 159 | + |
| 160 | +## Full Command Chain (Quick Reference) |
| 161 | + |
| 162 | +```bash |
| 163 | +# 1. Initialize project |
| 164 | +acfs newproj event-management --interactive |
| 165 | +cd /data/projects/event-management |
| 166 | + |
| 167 | +# 2. Set up Beads |
| 168 | +bd init |
| 169 | +git branch beads-sync main |
| 170 | +git push -u origin beads-sync |
| 171 | +bd config set sync.branch beads-sync |
| 172 | + |
| 173 | +# 3. Create initial tasks |
| 174 | +br create "Feature: Event management" --priority=1 |
| 175 | + |
| 176 | +# 4. Spawn agents |
| 177 | +ntm spawn event-management --cc=2 --cod=1 |
| 178 | +ntm attach event-management |
| 179 | + |
| 180 | +# 5. Flywheel loop... |
| 181 | +ubs $(git diff --name-only --cached) |
| 182 | + |
| 183 | +# 6. Land the plane |
| 184 | +br close 1 --reason "Completed" |
| 185 | +br sync --flush-only |
| 186 | +git pull --rebase |
| 187 | +git add .beads/ src/ |
| 188 | +git commit -m "feat: event management system" |
| 189 | +git push |
| 190 | +git status |
| 191 | +``` |
| 192 | + |
| 193 | +--- |
| 194 | + |
| 195 | +## Tool Reference |
| 196 | + |
| 197 | +| Purpose | Command | Notes | |
| 198 | +|---------|---------|-------| |
| 199 | +| Project creation | `acfs newproj` | Creates full agent-ready scaffold | |
| 200 | +| Agent orchestration | `ntm spawn`, `ntm attach`, `ntm send` | Start and coordinate agent sessions | |
| 201 | +| Task planning | `br ready`, `br create`, `br close` | Unblocked task list and lifecycle | |
| 202 | +| Beads sync | `br sync --flush-only` | Export state without git operations | |
| 203 | +| Graph analysis | `bv --robot-triage`, `bv --robot-plan` | Dependency and priority analysis | |
| 204 | +| Code quality | `ubs <files>` | Scan for bugs before committing | |
| 205 | +| Session search | `cass search` | Find previous solutions | |
| 206 | +| Agent memory | `cm context "<task>"` | Get relevant context from past work | |
| 207 | +| Account switching | `caam activate` | Switch between agent credentials | |
| 208 | +| Safety guard | `dcg test "<cmd>"` | Test if a command would be blocked | |
| 209 | + |
| 210 | +--- |
| 211 | + |
| 212 | +## Critical Constraints |
| 213 | + |
| 214 | +1. Never use `acfs newproj --no-br`, `--no-claude`, or `--no-agents` — these skip essential setup. |
| 215 | +2. Always use interactive mode on first run: `acfs newproj -i`. |
| 216 | +3. Work is incomplete until `git push` succeeds. |
| 217 | +4. Never delete files without explicit permission. |
| 218 | +5. Always run quality checks (tests, linter, type checks) before committing. |
| 219 | + |
| 220 | +--- |
| 221 | + |
| 222 | +## Project Directory Structure |
| 223 | + |
| 224 | +After `acfs newproj`, your project looks like: |
| 225 | + |
| 226 | +``` |
| 227 | +/data/projects/my-project/ |
| 228 | +├── .git/ # Git repository |
| 229 | +├── .beads/ # Beads issue tracking database |
| 230 | +├── .claude/ # Claude Code project settings |
| 231 | +├── AGENTS.md # Instructions for AI agents |
| 232 | +├── .gitignore # Standard ignores for project type |
| 233 | +└── [your code files] |
| 234 | +``` |
0 commit comments