buildflow-dev 1.0.7 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BuildFlow
2
2
 
3
- > Adaptive AI-powered development orchestration for Claude Code, Gemini CLI, Codex CLI, Cursor, Cline, and Continue.
3
+ > Spec-driven, multi-agent development orchestration with automatic token pruning — for Claude Code, Gemini CLI, Codex CLI, Cursor, Cline, and Continue.
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/buildflow-dev.svg)](https://www.npmjs.com/package/buildflow-dev)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -21,6 +21,7 @@
21
21
  - [The .buildflow/ Scaffold](#the-buildflow-scaffold)
22
22
  - [Template System](#template-system)
23
23
  - [9 Specialized Agents](#9-specialized-agents)
24
+ - [v4.0: Spec-Driven + Token Pruning](#v40-what-changed)
24
25
  - [Examples](#examples)
25
26
  - [Token Economics](#token-economics)
26
27
  - [Contributing](#contributing)
@@ -31,14 +32,18 @@
31
32
 
32
33
  ## What is BuildFlow?
33
34
 
34
- BuildFlow is a **CLI tool** that installs a structured AI workflow into any project. It does two things:
35
+ BuildFlow is a **CLI tool** that installs a spec-driven, multi-agent AI workflow into any project. It does two things:
35
36
 
36
- 1. **Scaffolds `.buildflow/`** — a folder of markdown files that act as persistent memory, project state, and agent instructions for your AI tool
37
- 2. **Installs slash commands** — writes `/buildflow-*` command files into whichever AI tools you use (Claude Code, Cursor, etc.)
37
+ 1. **Scaffolds `.buildflow/`** — markdown files that act as persistent memory, formal specs, project state, and agent instructions
38
+ 2. **Installs slash commands** — writes `/buildflow-*` command files into whichever AI tools you use (Claude Code, Cursor, Gemini CLI, etc.)
38
39
 
39
- Once installed, you work entirely inside your AI tool using `/buildflow-*` commands. BuildFlow itself stays out of your way — it only runs when you use the CLI (`buildflow audit`, `buildflow fix`, etc.) from the terminal.
40
+ Once installed, you work entirely inside your AI tool using `/buildflow-*` commands.
40
41
 
41
- **The core idea:** AI tools lose context as conversations grow ("context rot"). BuildFlow prevents this by breaking work into phases, using fresh agent sessions per task, and persisting only essential context in `.buildflow/memory/light.md`.
42
+ **Three core ideas that separate BuildFlow from other tools:**
43
+
44
+ - **Spec-first:** Every phase starts with a formal PRD + Technical Design + Acceptance Criteria. Plans trace to ACs. Ship is blocked if any AC is unsatisfied.
45
+ - **Context isolation:** Each agent receives a minimal context packet — only what it needs. No context rot, no wasted tokens.
46
+ - **Auto-prune:** `light.md` is automatically compressed at session start and after each ship. Long sessions stay lean.
42
47
 
43
48
  ---
44
49
 
@@ -89,13 +94,14 @@ These are installed into your AI tool and triggered by typing `/` (or `@` / `$`
89
94
 
90
95
  | Command | Agent | Purpose | Token Cost |
91
96
  |---------|-------|---------|-----------|
92
- | `/buildflow-start` | Strategist | Begin project: asks vision questions, detects mode, saves to `core/vision.md` | ~8K |
97
+ | `/buildflow-start` | Strategist | Begin project: vision questions, pruning of stale context, saves to `core/vision.md` | ~8K |
93
98
  | `/buildflow-think [topic]` | Researcher × 3 + Synthesizer | Parallel web research on a topic, synthesized into a recommendation | ~30K |
94
- | `/buildflow-plan [phase]` | Architect | Maps task dependencies, groups into parallel waves, writes `phases/N/PLAN.md` | ~20K |
95
- | `/buildflow-build [wave]` | Builder × N + Reviewer | Executes the plan wave-by-wave each wave auto-tests, auto-fixes failures, and only advances when fully green | ~50K/wave |
96
- | `/buildflow-test [wave]` | Reviewer | Standalone test + fix loopre-verify a wave or test a manual change outside of `/buildflow-build` | ~25K |
97
- | `/buildflow-check` | Reviewer × 3 | Three parallel reviewers check correctness, quality, and security | ~20K |
98
- | `/buildflow-ship` | Strategist + Security Auditor | Pre-ship security gate retrospective git tag | ~22K |
99
+ | `/buildflow-spec` | Strategist | **NEW** Generate formal PRD + Technical Design + Acceptance Criteria. Required before planning | ~18K |
100
+ | `/buildflow-plan [phase]` | Architect | Reads specs, maps tasks to ACs, groups into dependency waves, checks full AC coverage | ~20K |
101
+ | `/buildflow-build [wave]` | Builder × N + Reviewer | Execute waves with context-isolated Builderseach wave auto-tests, auto-fixes, only advances when green | ~50K/wave |
102
+ | `/buildflow-test [wave]` | Reviewer | Standalone test + fix loop re-verify a wave or test a manual change | ~25K |
103
+ | `/buildflow-check` | Reviewer × 4 | Spec compliance + correctness + quality + security in parallel | ~22K |
104
+ | `/buildflow-ship` | Strategist + Security Auditor | Spec gate + security gate + context pruning + git tag | ~22K |
99
105
 
100
106
  ### Workflow — Existing Codebases
101
107
 
@@ -125,12 +131,14 @@ If you're not sure where the bug is yet, use `/buildflow-help` first — it's a
125
131
  | Know what needs to change | `/buildflow-modify "fix description"` |
126
132
  | Don't know where the bug is | `/buildflow-help` first, then `/buildflow-modify` |
127
133
  | Tests failing after a change | `/buildflow-debug` |
134
+ | Production incident / tiny patch | `/buildflow-hotfix "description"` — no planning, no waves |
128
135
 
129
136
  ### Debugging & Deployment
130
137
 
131
138
  | Command | Agent | Purpose | Token Cost |
132
139
  |---------|-------|---------|-----------|
133
- | `/buildflow-debug ["error"]` | Surgeon | Root-cause analysis for failing tests or broken behavior traces error to source, applies minimal fix | ~20K |
140
+ | `/buildflow-hotfix "description"` | Surgeon | **NEW** — Fast-path: no spec, no plan, no waves. Restore point fix test commit. For incidents and small patches | ~10K |
141
+ | `/buildflow-debug ["error"]` | Surgeon | Root-cause analysis for failing tests — traces error to source, applies minimal fix | ~20K |
134
142
  | `/buildflow-deploy [env]` | Strategist | Pre-flight checks then deploy to staging or production | ~15K |
135
143
 
136
144
  ### Security
@@ -207,36 +215,62 @@ npx buildflow-dev init
207
215
 
208
216
  ---
209
217
 
210
- ### 3. PlanArchitect auto-generates phases and waves
218
+ ### 3. Specformal artifacts before any planning
219
+
220
+ ```
221
+ /buildflow-spec
222
+ ```
223
+
224
+ Strategist asks a few clarifying questions, then generates three locked files:
225
+
226
+ ```
227
+ .buildflow/specs/
228
+ ├── PRD.md ← What, for whom, success criteria, out of scope
229
+ ├── TDD.md ← Architecture, API contracts, component breakdown
230
+ └── acceptance.md ← Testable pass/fail criteria
231
+
232
+ AC-001: Given unauthenticated user, when POST /login with valid credentials,
233
+ then return 200 with session token
234
+ AC-002: Given invalid password, when POST /login, then return 401
235
+ AC-003: Given expired token, when any authenticated request, then return 401
236
+ ...
237
+ ```
238
+
239
+ User reviews and approves. Specs are locked. `/buildflow-plan` will not run without them.
240
+
241
+ ---
242
+
243
+ ### 4. Plan — Architect maps tasks to Acceptance Criteria
211
244
 
212
245
  ```
213
246
  /buildflow-plan
214
247
  ```
215
248
 
216
- The Architect reads `vision.md` and produces `.buildflow/phases/01/PLAN.md`:
249
+ The Architect reads `specs/acceptance.md` and produces `.buildflow/phases/01/PLAN.md` with every task traced to an AC:
217
250
 
218
251
  ```
219
252
  Phase 1 — Foundation
220
253
 
221
254
  Wave 1 (parallel — no dependencies):
222
- • Create database schema
223
- • Create project config files
224
- • Set up folder structure
255
+ • Create database schema [AC-001, AC-002]
256
+ • Create project config files [AC-NF-001]
225
257
 
226
258
  Wave 2 (depends on Wave 1):
227
- • Create data models
228
- • Create auth middleware
259
+ • Create auth middleware [AC-001, AC-002, AC-003]
260
+ • Create data models [AC-001]
229
261
 
230
262
  Wave 3 (depends on Wave 2):
231
- • Create API routes
232
- • Create service layer
263
+ • Create login API route [AC-001, AC-002]
264
+ • Create token refresh route [AC-003]
233
265
 
234
266
  Wave 4 (depends on Wave 3):
235
- • Create UI components
236
- • Write integration tests
267
+ • Create login UI form [AC-001, AC-002]
268
+ • Write integration tests [all ACs]
269
+
270
+ AC Coverage check: AC-001 ✓ AC-002 ✓ AC-003 ✓ AC-NF-001 ✓
237
271
  ```
238
272
 
239
- You didn't write any of this the Architect derived it from your vision.
273
+ Every AC is covered. The Architect won't write the plan if any AC is orphaned.
240
274
 
241
275
  ---
242
276
 
@@ -271,17 +305,20 @@ If a wave can't be fixed within 5 attempts, the build stops and reports exactly
271
305
 
272
306
  ---
273
307
 
274
- ### 5. Check, ship, and deploy
308
+ ### 6. Check, ship, and deploy
275
309
 
276
310
  ```
277
311
  /buildflow-check
278
312
  ```
279
- > 3 Reviewers in parallel: correctness / quality / security
313
+ > 4 Reviewers in parallel: spec compliance (all ACs?) / correctness / quality / security
280
314
 
281
315
  ```
282
316
  /buildflow-ship
283
317
  ```
284
- > Security gate retrospective written to `phases/01/retro.md` git tag
318
+ > Gate 0: all ACs satisfied blocks if any are ✗
319
+ > Gate 1: security scan — blocks on critical issues
320
+ > Gate 2: all tests passing
321
+ > Then: retrospective → context pruning (`light.md` compressed) → git tag
285
322
 
286
323
  ```
287
324
  /buildflow-deploy staging
@@ -416,19 +453,21 @@ buildflow-dev/
416
453
  │ │ all available /buildflow-* commands.
417
454
  │ │ {{APP_NAME}} is replaced with the detected project name.
418
455
  │ │
419
- │ └── commands/ 17 markdown files — one per slash command.
456
+ │ └── commands/ 19 markdown files — one per slash command.
420
457
  │ │ Each file is the full instruction set for that command.
421
458
  │ │ The AI reads and executes these when you trigger the command.
422
459
  │ │ Format: YAML frontmatter (name, description, agent, tools)
423
460
  │ │ followed by numbered steps the agent follows.
424
461
  │ │
425
- │ ├── start.md Vision gathering, mode detection (greenfield vs existing)
462
+ │ ├── start.md Vision gathering, mode detection, light.md pruning on session start
426
463
  │ ├── think.md Parallel research with up to 3 Researcher agents
427
- │ ├── plan.md Dependency mapping wave-based execution plan
464
+ │ ├── spec.md Generate PRD + TDD + Acceptance Criteria (required before plan)
465
+ │ ├── plan.md AC-traced dependency mapping → wave-based execution plan
428
466
  │ ├── build.md Wave-by-wave parallel Builder execution
429
467
  │ ├── test.md Run tests + UI verification after each wave
430
468
  │ ├── check.md 3-reviewer parallel quality check
431
- │ ├── ship.md Pre-ship security gate → retro → git tag
469
+ │ ├── ship.md Spec gate + security gate + context pruning → retro → git tag
470
+ │ ├── hotfix.md Fast-path fix — no spec, no plan, restore point → fix → test → commit
432
471
  │ ├── onboard.md One-time codebase analysis → MAP/PATTERNS/DEPENDENCIES/HOTSPOTS
433
472
  │ ├── modify.md Surgical code change with blast-radius analysis
434
473
  │ ├── refactor.md Quality improvement without behavior change
@@ -472,12 +511,17 @@ their-project/
472
511
  │ settings, parallelization limits. The AI adapts its
473
512
  │ explanation depth based on the experience: field.
474
513
 
514
+ ├── specs/ Generated by /buildflow-spec. Required before /buildflow-plan.
515
+ │ ├── PRD.md Product Requirements: what, for whom, success criteria, out of scope.
516
+ │ ├── TDD.md Technical Design: architecture, API contracts, component breakdown.
517
+ │ └── acceptance.md Acceptance Criteria (AC-001, AC-002...). Every plan task traces
518
+ │ to an AC. /buildflow-check verifies each. /buildflow-ship blocks
519
+ │ if any AC is unsatisfied.
520
+
475
521
  ├── memory/
476
- │ └── light.md The core of the memory system. Persists project essentials
477
- across AI sessions: app name, framework, phase, last session
478
- date, onboarding status, style fingerprint, recent decisions.
479
- │ Kept under 5K tokens deliberately — costs less to load than
480
- │ it saves in re-detection work.
522
+ │ └── light.md Persistent context across sessions. Auto-pruned to ≤3K tokens
523
+ at session start and after each /buildflow-ship. Archived phase
524
+ data moves to phases/N/retro.md — not deleted, just unloaded.
481
525
 
482
526
  ├── learnings/
483
527
  │ ├── glossary.md Project-specific jargon and BuildFlow concepts. Grows as
@@ -499,7 +543,8 @@ their-project/
499
543
 
500
544
  ├── phases/ One subfolder per phase (01/, 02/, etc.)
501
545
  │ └── 01/
502
- │ ├── PLAN.md Task breakdown with dependency waves
546
+ │ ├── PLAN.md Task breakdown with AC references and dependency waves.
547
+ │ │ Archived context from light.md lands here after /buildflow-ship.
503
548
  │ └── retro.md Written during /buildflow-ship: what worked, what didn't
504
549
 
505
550
  └── security/
@@ -638,6 +683,36 @@ buildflow fix
638
683
 
639
684
  ---
640
685
 
686
+ ## v4.0: What Changed
687
+
688
+ ### Spec-Driven Layer
689
+ Every phase now has a formal spec before any code is planned or written.
690
+
691
+ | Old flow | New flow |
692
+ |----------|----------|
693
+ | vision → plan → build | vision → **spec** → plan → build |
694
+ | Plan tasks were freeform | Plan tasks trace to Acceptance Criteria |
695
+ | Check was code review only | Check verifies every AC is satisfied |
696
+ | Ship had security gate | Ship has **spec gate** + security gate |
697
+
698
+ ### Context Isolation (Token Pruning)
699
+ Agents now receive minimal context packets instead of full project state.
700
+
701
+ | What changed | Effect |
702
+ |-------------|--------|
703
+ | Each Builder gets max 5 relevant files | −10–30K tokens per wave |
704
+ | `light.md` auto-pruned to ≤3K at session start | Prevents bloat across long projects |
705
+ | `light.md` pruned after every `/buildflow-ship` | Stale phase data archived, not re-loaded |
706
+ | Reviewers receive diff + ACs only (not full codebase) | Faster, more focused reviews |
707
+
708
+ ### New Commands
709
+ | Command | Purpose |
710
+ |---------|---------|
711
+ | `/buildflow-spec` | Generate PRD + TDD + Acceptance Criteria |
712
+ | `/buildflow-hotfix` | Fast-path for incidents — no planning overhead |
713
+
714
+ ---
715
+
641
716
  ## Token Economics
642
717
 
643
718
  | Scenario | Tokens | Notes |
@@ -645,10 +720,18 @@ buildflow fix
645
720
  | Greenfield full workflow | 130–160K | All phases, one session |
646
721
  | Onboarding existing project | +35K | One-time, never again |
647
722
  | Existing project after onboard | 130–160K | Same as greenfield |
723
+ | `/buildflow-spec` | ~18K | One-time per phase — produces PRD + TDD + ACs |
648
724
  | Security gate (per ship) | +10K | Always runs with `/buildflow-ship` |
649
- | Light memory load (per session) | ~2K | **Saves** ~10K in re-detection |
650
-
651
- Light memory pays for itself after one session loading 2K to avoid re-detecting framework, phase, and preferences each time.
725
+ | Light memory load (per session) | ~1.5K | Pruned to ≤3K — **saves** ~10K in re-detection |
726
+ | Context pruning savings | −5–15K | Old phase data archived, not reloaded each session |
727
+ | Hotfix (vs full build) | ~10K vs ~50K | cheaper for small patches |
728
+ | Per-agent context packets | −10–30K | Builders get minimal context, not full codebase |
729
+
730
+ **Token efficiency strategy:**
731
+ - `light.md` stays under 3K (auto-pruned after each ship and at session start)
732
+ - Each agent gets a context packet: only task spec + relevant files + style rules
733
+ - Builders never receive full codebase — they get max 5 relevant files
734
+ - Old phase data lives in `phases/N/retro.md`, not loaded unless needed
652
735
 
653
736
  ---
654
737
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buildflow-dev",
3
- "version": "1.0.7",
4
- "description": "Adaptive AI-powered development orchestration. Works with Claude Code, Gemini CLI, Codex CLI, Cursor, and more.",
3
+ "version": "4.0.1",
4
+ "description": "Spec-driven, multi-agent AI development orchestration with automatic token pruning. Works with Claude Code, Gemini CLI, Codex CLI, Cursor, and more.",
5
5
  "keywords": [
6
6
  "ai",
7
7
  "claude",
@@ -11,6 +11,8 @@
11
11
  "developer-tools",
12
12
  "cli",
13
13
  "workflow",
14
+ "spec-driven-development",
15
+ "multi-agent",
14
16
  "scaffolding",
15
17
  "security-audit",
16
18
  "code-generation"
@@ -80,6 +80,7 @@ function scaffoldBuildflow(appName, projectInfo) {
80
80
  const dirs = [
81
81
  'core', 'you', 'memory', 'phases',
82
82
  'learnings', 'research', 'codebase',
83
+ 'specs',
83
84
  'security/reports', 'security/rules',
84
85
  'security/suppressions',
85
86
  ]
@@ -451,6 +452,24 @@ Phase 0 — Initial setup complete. Run \`/buildflow-start\` to begin.
451
452
  ---
452
453
 
453
454
  *New decisions are appended below by \`/buildflow-think\` and \`/buildflow-plan\`.*
455
+ `)
456
+
457
+ // ── specs/ ──────────────────────────────────────────────────────────────────
458
+ writeFileSync(join(base, 'specs', 'README.md'),
459
+ `# Specs
460
+
461
+ > Generated by \`/buildflow-spec\`. Run it after \`/buildflow-start\`.
462
+
463
+ | File | Purpose |
464
+ |------|---------|
465
+ | \`PRD.md\` | Product Requirements — what, for whom, success criteria |
466
+ | \`TDD.md\` | Technical Design — architecture, API contracts, decisions |
467
+ | \`acceptance.md\` | Acceptance Criteria — testable pass/fail conditions per feature |
468
+
469
+ These files are the source of truth for planning and verification.
470
+ \`/buildflow-plan\` traces every task to an AC.
471
+ \`/buildflow-check\` verifies every AC is satisfied.
472
+ \`/buildflow-ship\` blocks if any AC is unmet.
454
473
  `)
455
474
 
456
475
  // ── security/DEBT.md ────────────────────────────────────────────────────────
@@ -620,8 +620,8 @@ function loadCommandTemplates() {
620
620
  const templatesDir = join(__dirname, '../../templates/commands')
621
621
  const commands = {}
622
622
  const commandNames = [
623
- 'start', 'think', 'plan', 'build', 'test', 'check', 'ship',
624
- 'onboard', 'modify', 'refactor', 'audit',
623
+ 'start', 'think', 'spec', 'plan', 'build', 'test', 'check', 'ship',
624
+ 'onboard', 'modify', 'refactor', 'hotfix', 'audit',
625
625
  'debug', 'deploy',
626
626
  'status', 'explain', 'back', 'help',
627
627
  ]
@@ -1,6 +1,6 @@
1
1
  # {{APP_NAME}} — Claude Code Configuration
2
2
 
3
- This project uses **BuildFlow v3.0** for adaptive AI-powered development orchestration.
3
+ This project uses **BuildFlow v4.0** for spec-driven, multi-agent development orchestration.
4
4
 
5
5
  ## Session Start Checklist (Run Every Time)
6
6
 
@@ -15,45 +15,57 @@ Before doing anything else at the start of every session:
15
15
  Then display the contents of UPDATE.md.
16
16
  - If the file does not exist, proceed silently.
17
17
 
18
- 2. **Load memory** — read `.buildflow/memory/light.md` for project context
18
+ 2. **Prune memory** — read `.buildflow/memory/light.md`. If over 3K tokens, prune it:
19
+ - Archive phase task lists and build timestamps to `phases/[last phase]/retro.md`
20
+ - Keep: app_name, framework, language, current_phase, spec_status, style_fingerprint, last 2 decisions
21
+ - Report: "Context pruned: light.md [X] → [Y] tokens"
22
+
19
23
  3. **Load state** — read `.buildflow/core/state.md` for current phase and status
20
24
 
21
25
  ---
22
26
 
23
- ## Quick Start
24
-
25
- Type `/` in Claude Code to see available commands:
26
-
27
- - `/buildflow-start` — begin or continue the project
28
- - `/buildflow-onboard` — analyze existing codebase (run once for existing projects)
29
- - `/buildflow-think` — research and discuss
30
- - `/buildflow-plan` — create execution plan
31
- - `/buildflow-build` — implement the plan
32
- - `/buildflow-test` — run tests and verify UI/functionality after each wave
33
- - `/buildflow-check` — verify quality with 3 parallel reviewers
34
- - `/buildflow-debug` — root-cause analysis when tests fail or something breaks
35
- - `/buildflow-ship` — finalize with security gate
36
- - `/buildflow-deploy` — pre-flight checks then deploy to staging or production
37
- - `/buildflow-audit` — run security scan
38
- - `/buildflow-modify` — surgical change or bugfix to existing code
39
- - `/buildflow-status` — see where you are
40
- - `/buildflow-help` — get help or recover from issues
27
+ ## BuildFlow v4.0 Workflow
41
28
 
42
- ## Always Do at Session Start
29
+ ```
30
+ /buildflow-start → capture vision
31
+ /buildflow-think → research (optional)
32
+ /buildflow-spec → generate PRD + TDD + Acceptance Criteria ← NEW
33
+ /buildflow-plan → map tasks to ACs, group into waves
34
+ /buildflow-build → execute waves with auto-test + auto-fix
35
+ /buildflow-check → verify all ACs satisfied
36
+ /buildflow-ship → spec gate + security gate + context pruning
37
+ /buildflow-deploy → pre-flight + deploy to staging/production
38
+ ```
43
39
 
44
- 1. Read `.buildflow/memory/light.md` for project context
45
- 2. Read `.buildflow/core/state.md` for current phase and status
46
- 3. If onboarded: load `.buildflow/codebase/MAP.md`
40
+ ## Quick Reference
41
+
42
+ | Command | When to use |
43
+ |---------|-------------|
44
+ | `/buildflow-start` | Begin or continue the project |
45
+ | `/buildflow-spec` | Define PRD, TDD, Acceptance Criteria before planning |
46
+ | `/buildflow-plan` | Create spec-traced wave plan |
47
+ | `/buildflow-build` | Execute plan — auto-tests and auto-fixes each wave |
48
+ | `/buildflow-test` | Re-verify a wave or test a manual change |
49
+ | `/buildflow-check` | Verify all ACs satisfied + code quality |
50
+ | `/buildflow-ship` | Spec gate + security gate + context prune + git tag |
51
+ | `/buildflow-deploy` | Pre-flight checks + deploy staging/production |
52
+ | `/buildflow-hotfix` | Fast-path fix — no planning, no waves |
53
+ | `/buildflow-debug` | Root-cause analysis when tests fail |
54
+ | `/buildflow-onboard` | One-time analysis of existing codebase |
55
+ | `/buildflow-modify` | Surgical change or bugfix to existing code |
56
+ | `/buildflow-audit` | OWASP Top 10 security scan |
57
+ | `/buildflow-status` | See current phase and progress |
58
+ | `/buildflow-help` | Diagnostic mode + recovery |
47
59
 
48
60
  ## Core Rules
49
61
 
62
+ - Each agent receives a **minimal context packet** — only what it needs, nothing else
63
+ - `light.md` must stay under 3K tokens — prune at session start if over
50
64
  - Ask confidence (1-5) before locking major decisions
51
- - Show alternatives before making architectural choices
52
- - Add `LEARN:` comments when introducing unfamiliar patterns
65
+ - Run `/buildflow-spec` before `/buildflow-plan` no spec, no plan
66
+ - `/buildflow-ship` blocks if any Acceptance Criterion is unsatisfied
53
67
  - Create git restore points before destructive operations
54
68
  - Run `/buildflow-audit` before every `/buildflow-ship`
55
- - Cite research sources with trust scores (1-5)
56
- - Keep `.buildflow/memory/light.md` under 5K tokens
57
69
 
58
70
  ## Agents
59
71
 
@@ -62,14 +74,14 @@ Type `/` in Claude Code to see available commands:
62
74
  | Strategist | Vision, decisions, direction |
63
75
  | Researcher | Parallel web research with sources |
64
76
  | Synthesizer | Combines research findings |
65
- | Architect | Dependency-aware planning |
66
- | Builder | Code matching project style |
67
- | Reviewer | Quality checks |
77
+ | Architect | Spec-traced dependency planning |
78
+ | Builder | Code matching project style, AC-referenced |
79
+ | Reviewer | Spec compliance + quality checks |
68
80
  | Cartographer | Maps existing codebases |
69
81
  | Surgeon | Precise modifications to existing code |
70
82
  | Security Auditor | OWASP Top 10 scanning |
71
83
 
72
- Each agent gets a **fresh context window** — no context rot.
84
+ Each agent gets a **fresh context window** with a **minimal context packet** — no context rot, no wasted tokens.
73
85
 
74
86
  ## Project Structure
75
87
 
@@ -78,10 +90,14 @@ Each agent gets a **fresh context window** — no context rot.
78
90
  ├── core/
79
91
  │ ├── vision.md ← What we're building
80
92
  │ └── state.md ← Current phase and status
93
+ ├── specs/ ← Generated by /buildflow-spec ← NEW
94
+ │ ├── PRD.md ← Product Requirements
95
+ │ ├── TDD.md ← Technical Design
96
+ │ └── acceptance.md ← Acceptance Criteria (AC-001, AC-002...)
81
97
  ├── you/
82
98
  │ └── preferences.md ← Experience level, style prefs
83
99
  ├── memory/
84
- │ └── light.md ← Persistent context (≤5K tokens)
100
+ │ └── light.md ← Persistent context (≤3K tokens, auto-pruned)
85
101
  ├── codebase/ ← Generated by /buildflow-onboard
86
102
  │ ├── MAP.md
87
103
  │ ├── PATTERNS.md