feed-the-machine 1.0.0

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.
Files changed (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +268 -0
  3. package/bin/generate-manifest.mjs +210 -0
  4. package/bin/install.mjs +114 -0
  5. package/ftm/SKILL.md +88 -0
  6. package/ftm-audit/SKILL.md +146 -0
  7. package/ftm-audit/references/protocols/PROJECT-PATTERNS.md +91 -0
  8. package/ftm-audit/references/protocols/RUNTIME-WIRING.md +66 -0
  9. package/ftm-audit/references/protocols/WIRING-CONTRACTS.md +135 -0
  10. package/ftm-audit/references/strategies/AUTO-FIX-STRATEGIES.md +69 -0
  11. package/ftm-audit/references/templates/REPORT-FORMAT.md +96 -0
  12. package/ftm-audit/scripts/run-knip.sh +23 -0
  13. package/ftm-audit.yml +2 -0
  14. package/ftm-brainstorm/SKILL.md +379 -0
  15. package/ftm-brainstorm/evals/evals.json +100 -0
  16. package/ftm-brainstorm/evals/promptfoo.yaml +109 -0
  17. package/ftm-brainstorm/references/agent-prompts.md +224 -0
  18. package/ftm-brainstorm/references/plan-template.md +121 -0
  19. package/ftm-brainstorm.yml +2 -0
  20. package/ftm-browse/SKILL.md +415 -0
  21. package/ftm-browse/daemon/browser-manager.ts +206 -0
  22. package/ftm-browse/daemon/bun.lock +30 -0
  23. package/ftm-browse/daemon/cli.ts +347 -0
  24. package/ftm-browse/daemon/commands.ts +410 -0
  25. package/ftm-browse/daemon/main.ts +357 -0
  26. package/ftm-browse/daemon/package.json +17 -0
  27. package/ftm-browse/daemon/server.ts +189 -0
  28. package/ftm-browse/daemon/snapshot.ts +519 -0
  29. package/ftm-browse/daemon/tsconfig.json +22 -0
  30. package/ftm-browse.yml +4 -0
  31. package/ftm-codex-gate/SKILL.md +302 -0
  32. package/ftm-codex-gate.yml +2 -0
  33. package/ftm-config/SKILL.md +310 -0
  34. package/ftm-config.default.yml +80 -0
  35. package/ftm-config.yml +2 -0
  36. package/ftm-council/SKILL.md +132 -0
  37. package/ftm-council/references/prompts/CLAUDE-INVESTIGATION.md +60 -0
  38. package/ftm-council/references/prompts/CODEX-INVESTIGATION.md +58 -0
  39. package/ftm-council/references/prompts/GEMINI-INVESTIGATION.md +58 -0
  40. package/ftm-council/references/prompts/REBUTTAL-TEMPLATE.md +57 -0
  41. package/ftm-council/references/protocols/PREREQUISITES.md +47 -0
  42. package/ftm-council/references/protocols/STEP-0-FRAMING.md +46 -0
  43. package/ftm-council.yml +2 -0
  44. package/ftm-dashboard.yml +4 -0
  45. package/ftm-debug/SKILL.md +146 -0
  46. package/ftm-debug/references/phases/PHASE-0-INTAKE.md +58 -0
  47. package/ftm-debug/references/phases/PHASE-1-TRIAGE.md +46 -0
  48. package/ftm-debug/references/phases/PHASE-2-WAR-ROOM-AGENTS.md +279 -0
  49. package/ftm-debug/references/phases/PHASE-3-TO-6-EXECUTION.md +436 -0
  50. package/ftm-debug/references/protocols/BLACKBOARD.md +86 -0
  51. package/ftm-debug/references/protocols/EDGE-CASES.md +103 -0
  52. package/ftm-debug.yml +2 -0
  53. package/ftm-diagram/SKILL.md +233 -0
  54. package/ftm-diagram.yml +2 -0
  55. package/ftm-executor/SKILL.md +657 -0
  56. package/ftm-executor/references/STYLE-TEMPLATE.md +73 -0
  57. package/ftm-executor/references/phases/PHASE-0-VERIFICATION.md +62 -0
  58. package/ftm-executor/references/phases/PHASE-2-AGENT-ASSEMBLY.md +34 -0
  59. package/ftm-executor/references/phases/PHASE-3-WORKTREES.md +38 -0
  60. package/ftm-executor/references/phases/PHASE-4-5-AUDIT.md +72 -0
  61. package/ftm-executor/references/phases/PHASE-4-DISPATCH.md +66 -0
  62. package/ftm-executor/references/phases/PHASE-5-5-CODEX-GATE.md +73 -0
  63. package/ftm-executor/references/protocols/DOCUMENTATION-BOOTSTRAP.md +36 -0
  64. package/ftm-executor/references/protocols/MODEL-PROFILE.md +44 -0
  65. package/ftm-executor/references/protocols/PROGRESS-TRACKING.md +66 -0
  66. package/ftm-executor/runtime/ftm-runtime.mjs +252 -0
  67. package/ftm-executor/runtime/package.json +8 -0
  68. package/ftm-executor.yml +2 -0
  69. package/ftm-git/SKILL.md +195 -0
  70. package/ftm-git/evals/evals.json +26 -0
  71. package/ftm-git/evals/promptfoo.yaml +75 -0
  72. package/ftm-git/hooks/post-commit-experience.sh +92 -0
  73. package/ftm-git/references/patterns/SECRET-PATTERNS.md +104 -0
  74. package/ftm-git/references/protocols/REMEDIATION.md +139 -0
  75. package/ftm-git/scripts/pre-commit-secrets.sh +110 -0
  76. package/ftm-git.yml +2 -0
  77. package/ftm-intent/SKILL.md +198 -0
  78. package/ftm-intent.yml +2 -0
  79. package/ftm-map.yml +2 -0
  80. package/ftm-mind/SKILL.md +986 -0
  81. package/ftm-mind/evals/promptfoo.yaml +142 -0
  82. package/ftm-mind/references/blackboard-schema.md +328 -0
  83. package/ftm-mind/references/complexity-guide.md +110 -0
  84. package/ftm-mind/references/event-registry.md +299 -0
  85. package/ftm-mind/references/mcp-inventory.md +296 -0
  86. package/ftm-mind/references/protocols/COMPLEXITY-SIZING.md +72 -0
  87. package/ftm-mind/references/protocols/MCP-HEURISTICS.md +32 -0
  88. package/ftm-mind/references/protocols/PLAN-APPROVAL.md +80 -0
  89. package/ftm-mind/references/reflexion-protocol.md +249 -0
  90. package/ftm-mind/references/routing/SCENARIOS.md +22 -0
  91. package/ftm-mind/references/routing-scenarios.md +35 -0
  92. package/ftm-mind.yml +2 -0
  93. package/ftm-pause/SKILL.md +133 -0
  94. package/ftm-pause/references/protocols/SKILL-RESTORE-PROTOCOLS.md +186 -0
  95. package/ftm-pause/references/protocols/VALIDATION.md +80 -0
  96. package/ftm-pause.yml +2 -0
  97. package/ftm-researcher.yml +2 -0
  98. package/ftm-resume/SKILL.md +166 -0
  99. package/ftm-resume/references/protocols/VALIDATION.md +172 -0
  100. package/ftm-resume.yml +2 -0
  101. package/ftm-retro/SKILL.md +189 -0
  102. package/ftm-retro/references/protocols/SCORING-RUBRICS.md +89 -0
  103. package/ftm-retro/references/templates/REPORT-FORMAT.md +109 -0
  104. package/ftm-retro.yml +2 -0
  105. package/ftm-routine.yml +4 -0
  106. package/ftm-state/blackboard/context.json +23 -0
  107. package/ftm-state/blackboard/experiences/index.json +9 -0
  108. package/ftm-state/blackboard/patterns.json +6 -0
  109. package/ftm-state/schemas/context.schema.json +130 -0
  110. package/ftm-state/schemas/experience-index.schema.json +77 -0
  111. package/ftm-state/schemas/experience.schema.json +78 -0
  112. package/ftm-state/schemas/patterns.schema.json +44 -0
  113. package/ftm-upgrade/SKILL.md +153 -0
  114. package/ftm-upgrade/scripts/check-version.sh +76 -0
  115. package/ftm-upgrade/scripts/upgrade.sh +143 -0
  116. package/ftm-upgrade.yml +2 -0
  117. package/ftm.yml +2 -0
  118. package/install.sh +102 -0
  119. package/package.json +74 -0
  120. package/uninstall.sh +25 -0
@@ -0,0 +1,73 @@
1
+ # Code Style — Optimized for AI Agents
2
+
3
+ > This file defines the code standards for this project. It is read by Codex during adversarial review
4
+ > and enforced automatically. Humans set it once; AI agents follow it on every commit.
5
+
6
+ ## Hard Limits
7
+
8
+ | Rule | Limit | Rationale |
9
+ |---|---|---|
10
+ | Max lines per file | 1000 | Any AI agent can read one file and understand it without needing 10 others as context |
11
+ | Max lines per function | 50 | Trace a bug by following imports without blowing context window |
12
+ | Exports per component file | 1 (co-located helpers OK) | One responsibility per file, clear import targets |
13
+ | Barrel files (index.ts re-exports) | Forbidden | Direct imports only — barrel files obscure dependency graphs |
14
+
15
+ ## Structure Rules
16
+
17
+ - **Naming over comments**: If a function needs a comment to explain what it does, it's named wrong
18
+ - **Max 3 nesting levels**: If a file has more than 3 levels of nesting, split it
19
+ - **Co-locate related functions**: If two functions always get called together, they should be in the same module
20
+ - **Max 5 dependencies per module**: If a module has 5+ imports from different modules, it's doing too much — split it
21
+
22
+ ## Why These Rules
23
+
24
+ These aren't aesthetic preferences. They exist so any AI agent can:
25
+ - **Read one file** and understand it without needing 10 others as context
26
+ - **Trace a bug** by following imports without blowing context window
27
+ - **Modify one function** without risking side effects in a 5000-line file
28
+ - **Review changes** against INTENT.md without getting lost in complexity
29
+
30
+ ## Naming Conventions
31
+
32
+ | Element | Convention | Example |
33
+ |---|---|---|
34
+ | Files (components) | PascalCase | `UserProfile.tsx` |
35
+ | Files (utilities) | camelCase | `formatDate.ts` |
36
+ | Files (hooks) | camelCase with `use` prefix | `useAuth.ts` |
37
+ | Functions | camelCase | `validateInput()` |
38
+ | Constants | UPPER_SNAKE_CASE | `MAX_RETRIES` |
39
+ | Types/Interfaces | PascalCase | `UserSession` |
40
+ | CSS classes | kebab-case | `.nav-container` |
41
+
42
+ ## Error Handling
43
+
44
+ - **Fail fast, fail explicitly**: Detect and report errors immediately with meaningful context
45
+ - **Never suppress silently**: All errors must be logged, handled, or escalated
46
+ - **Context preservation**: Error messages include what was attempted, what failed, and where
47
+
48
+ ## Testing Standards
49
+
50
+ - Tests live next to the code they test: `Component.test.tsx` alongside `Component.tsx`
51
+ - Test file names mirror source file names with `.test.` or `.spec.` suffix
52
+ - Each test file focuses on one module — no cross-module test files
53
+ - Mock data must match real API contracts (see project CLAUDE.md)
54
+
55
+ ## Import Order
56
+
57
+ 1. External packages (react, next, etc.)
58
+ 2. Internal absolute imports (@/components, @/utils)
59
+ 3. Relative imports (./Component, ../utils)
60
+ 4. Type imports (import type { ... })
61
+ 5. Style imports (import './styles.css')
62
+
63
+ Blank line between each group.
64
+
65
+ ## Customization
66
+
67
+ This is a starting template. Projects should customize:
68
+ - **Naming conventions**: Adapt to your language/framework conventions
69
+ - **Hard limits**: Adjust thresholds if your domain requires longer functions (e.g., complex algorithms)
70
+ - **Testing standards**: Add framework-specific patterns (Jest, Vitest, pytest, etc.)
71
+ - **Import order**: Adapt to your project's module resolution strategy
72
+
73
+ When customizing, keep the "Why These Rules" section — it reminds both humans and AI agents why the constraints exist.
@@ -0,0 +1,62 @@
1
+ # Phase 0.5 — Plan Verification
2
+
3
+ ## Plan Checker Agent Prompt
4
+
5
+ Spawn a **Plan Checker** agent with this prompt (use `planning` model from ftm-config):
6
+
7
+ ```
8
+ You are a plan quality checker. Analyze this implementation plan and report issues.
9
+ Do NOT implement anything — just verify the plan is sound.
10
+
11
+ Plan path: [path]
12
+
13
+ Check these dimensions:
14
+
15
+ 1. STRUCTURAL INTEGRITY
16
+ - Every task has: description, files list, dependencies, acceptance criteria
17
+ - Task numbering is consistent (no gaps, no duplicates)
18
+ - Dependencies reference valid task numbers
19
+ - No circular dependencies (Task A depends on B, B depends on A)
20
+
21
+ 2. DEPENDENCY GRAPH VALIDITY
22
+ - Build the full dependency graph
23
+ - Verify all referenced tasks exist
24
+ - Check for implicit dependencies (two tasks modifying the same file
25
+ but not declared as dependent)
26
+ - Flag tasks with too many dependencies (>3 usually means bad decomposition)
27
+
28
+ 3. FILE CONFLICT DETECTION
29
+ - Map every task to its file list
30
+ - Flag any files touched by multiple tasks in the same wave
31
+ - These MUST be sequential, not parallel — if the plan puts them
32
+ in the same wave, that's a bug
33
+
34
+ 4. SCOPE REASONABLENESS
35
+ - Flag tasks that touch >10 files (probably too big for one agent)
36
+ - Flag tasks with vague acceptance criteria ("make it work", "looks good")
37
+ - Flag tasks with no verification steps
38
+
39
+ 5. PROJECT COMPATIBILITY
40
+ - Check that file paths reference real directories in the project
41
+ - Verify the tech stack matches what the plan assumes
42
+ - Check that dependencies/libraries the plan references are installed
43
+ or listed in package.json/requirements.txt
44
+
45
+ Return a structured report:
46
+
47
+ PASS — plan is sound, proceed to execution
48
+ WARN — issues found but execution can proceed (list warnings)
49
+ FAIL — critical issues that must be fixed before execution (list blockers)
50
+
51
+ For FAIL findings, suggest specific fixes.
52
+ ```
53
+
54
+ ## Interpreting Results
55
+
56
+ - **PASS**: Proceed to Phase 1
57
+ - **WARN**: Show warnings to user, proceed unless they object
58
+ - **FAIL**: Present blockers and suggested fixes. Ask user: fix the plan and re-run, or override and execute anyway?
59
+
60
+ ## File Conflict Auto-Resolution
61
+
62
+ If the plan checker finds file conflicts between tasks in the same wave, automatically restructure the wave ordering to make conflicting tasks sequential. Report the change to the user before proceeding.
@@ -0,0 +1,34 @@
1
+ # Phase 2 — Agent Assembly
2
+
3
+ ## Matching Domain Clusters to Agents
4
+
5
+ For each domain cluster identified in Phase 1, select the best-fit agent from the table below:
6
+
7
+ | Domain | Likely Agent |
8
+ |--------|-------------|
9
+ | React/UI/CSS/components | frontend-developer |
10
+ | API/server/database | backend-architect |
11
+ | CI/CD/deploy/infra | devops-automator |
12
+ | Tests/coverage | test-writer-fixer |
13
+ | Mobile/native | mobile-app-builder |
14
+ | AI/ML features | ai-engineer |
15
+ | General coding | general-purpose |
16
+
17
+ Check available agent types in the Agent tool. Map each cluster to the closest fit before considering custom creation.
18
+
19
+ ## Creating Custom Agents
20
+
21
+ When no existing agent covers a task cluster adequately — for example, "theme system with CSS custom properties and dark mode" or "WebSocket terminal integration" — create a purpose-built agent prompt.
22
+
23
+ Write a focused agent definition with these sections:
24
+
25
+ - **Domain expertise**: What this agent knows deeply
26
+ - **Task context**: The specific tasks from the plan it will handle
27
+ - **Standards**: Coding conventions from the project (infer from existing code)
28
+ - **Constraints**: Don't touch files outside your scope
29
+
30
+ The prompt text becomes the `prompt` parameter when spawning the agent in Phase 4.
31
+
32
+ ## Building the Agent Library
33
+
34
+ Store custom agent prompts in the skill workspace as reference prompts so they can be reused across projects. A "theme-engineer" agent created for one project's CSS system can be reused next time themes come up. Over time, the agent library grows with battle-tested specialists.
@@ -0,0 +1,38 @@
1
+ # Phase 3 — Worktree Setup
2
+
3
+ ## Per-Agent Worktree Creation
4
+
5
+ Each agent in the current wave gets its own isolated worktree. Run these steps for every agent before dispatch:
6
+
7
+ **1. Ensure `.worktrees/` is in `.gitignore`**
8
+
9
+ Check the project's `.gitignore`. If `.worktrees/` is missing, add it before creating any worktrees.
10
+
11
+ **2. Create the worktree branch and directory**
12
+
13
+ ```bash
14
+ git worktree add .worktrees/plan-exec-<agent-name> -b plan-exec/<agent-name>
15
+ ```
16
+
17
+ Example for frontend agent handling tasks 1–4:
18
+ ```bash
19
+ git worktree add .worktrees/plan-exec-frontend-tasks-1-4 -b plan-exec/frontend-tasks-1-4
20
+ ```
21
+
22
+ **3. Run project setup in the worktree**
23
+
24
+ ```bash
25
+ cd .worktrees/plan-exec-<agent-name>
26
+ npm install # or yarn install / pip install / etc.
27
+ ```
28
+
29
+ **4. Verify the worktree starts clean**
30
+
31
+ Run the test suite or at minimum the build. If the baseline is already failing, note it before dispatch so the agent doesn't get blamed for pre-existing failures.
32
+
33
+ ## Naming Convention
34
+
35
+ Branch names: `plan-exec/<agent-name>`
36
+ Worktree paths: `.worktrees/plan-exec-<agent-name>`
37
+
38
+ Use the agent's role as the name component — e.g., `frontend`, `backend`, `testing`, `devops`. For waves with multiple agents of the same type, append a task range: `frontend-tasks-1-4`.
@@ -0,0 +1,72 @@
1
+ # Phase 4.5 — Post-Task Audit Gate
2
+
3
+ ## Per-Task Verification Gate
4
+
5
+ Before running ftm-audit, verify these four checks for every task:
6
+
7
+ 1. **Tests pass** — any tests written or affected by the task must be green
8
+ 2. **INTENT.md updated** — check that new/changed functions have entries in their module's INTENT.md
9
+ 3. **Diagram updated** — check that new/changed functions have nodes in their module's DIAGRAM.mmd
10
+ 4. **Full suite still green** — run the project's test suite (if one exists) and verify no regressions
11
+
12
+ 5. **Visual smoke test (optional)** — If the project has a running dev server (detected via `lsof -i :3000` or `lsof -i :5173` or configured in plan metadata as `dev_server_url`), run:
13
+ - `$PB goto <dev_server_url>`
14
+ - `$PB screenshot`
15
+ - Verify the screenshot shows a rendered page (not a blank screen or error page)
16
+ - If the task modified UI components, `$PB snapshot -i` to verify new elements appear in the ARIA tree
17
+
18
+ Where `$PB` is `$HOME/.claude/skills/ftm-browse/bin/ftm-browse`.
19
+
20
+ **Graceful degradation**: If ftm-browse binary is not installed, skip visual checks with a note: "Visual smoke test skipped — ftm-browse not installed." Do not fail the task.
21
+
22
+ A task is NOT marked complete until checks 1–4 pass (check 5 is optional).
23
+
24
+ **Failure handling:**
25
+ - Test failures → agent must fix before task completes
26
+ - Missing INTENT.md entries → add them (use ftm-intent format)
27
+ - Missing diagram nodes → add them (use ftm-diagram format)
28
+ - Regression failures → investigate and fix before continuing
29
+
30
+ ## Running ftm-audit
31
+
32
+ Use `review` model from ftm-config when spawning audit agents.
33
+
34
+ **Invoke ftm-audit** scoped to the files the task modified (check the agent's commits). If the task has a `Wiring:` contract in the plan, pass it to ftm-audit for contract checking. Run all three layers: knip static analysis → adversarial audit → auto-fix.
35
+
36
+ ## Interpreting Audit Results
37
+
38
+ **PASS (no findings):** Mark task complete, proceed to next task.
39
+
40
+ **PASS after auto-fix:** FTM-audit found issues and fixed them automatically. Commit the fixes in the agent's worktree with message "Auto-fix: wire [description]". Mark task complete.
41
+
42
+ **FAIL (manual intervention needed):** Task stays in-progress. Report to the user:
43
+ ```
44
+ Task [N] audit failed — manual intervention needed:
45
+ - [finding 1 with file:line]
46
+ - [finding 2 with file:line]
47
+ Suggested fixes: [ftm-audit's suggestions]
48
+ ```
49
+ Wait for user input before continuing to next task.
50
+
51
+ ## Task Completion Report Format
52
+
53
+ ```
54
+ Task [N]: [title] — COMPLETE
55
+ Audit: PASS (0 findings) | PASS after auto-fix (2 fixed) | FAIL (1 manual)
56
+ [if auto-fixed: list what was fixed]
57
+ [if failed: list outstanding issues]
58
+ ```
59
+
60
+ ## When to Skip the Audit
61
+
62
+ **Skip when:**
63
+ - The task only modified `.md`, `.txt`, `.json` (config), or `.yml` files
64
+ - The task is explicitly marked as a "setup" or "scaffold" task
65
+ - The project has no `package.json` AND no identifiable entry point
66
+ - The plan marks the task with `audit: skip`
67
+
68
+ The plan syntax for explicit skipping:
69
+ ```yaml
70
+ audit: skip
71
+ reason: "Documentation-only task" | "Config change" | "Test-only change"
72
+ ```
@@ -0,0 +1,66 @@
1
+ # Phase 4 — Agent Dispatch Prompt Template
2
+
3
+ ## Full Prompt Template
4
+
5
+ Use this structure for every agent dispatched in Phase 4. Fill in bracketed fields from the plan and execution context.
6
+
7
+ ```
8
+ You are working in an isolated git worktree at: [worktree path]
9
+ Your working directory is: [worktree path]
10
+
11
+ ## Your Assignment
12
+
13
+ Execute the following tasks from the plan:
14
+
15
+ [paste the relevant task sections verbatim from the plan doc]
16
+
17
+ ## Plan Context
18
+
19
+ Full plan: [plan path]
20
+ Your tasks: [task numbers]
21
+ Dependencies satisfied: [list what was already completed in prior waves]
22
+
23
+ ## Execution Loop
24
+
25
+ For EACH task, follow this cycle:
26
+
27
+ 1. **Implement** — Follow the plan's steps exactly. Read files before modifying them. Use the project's existing patterns.
28
+
29
+ 2. **Commit** — Stage and commit your changes with a clear message describing what was done. Never reference AI/agent tools in commit messages.
30
+
31
+ 2.5. **Document** — Every commit must include documentation updates:
32
+ - Update the module's INTENT.md: add entries for new functions, update entries for changed functions (Does/Why/Relationships/Decisions format)
33
+ - Update the module's DIAGRAM.mmd: add nodes for new functions, update edges for changed dependencies
34
+ - If you created a new module directory, also create its INTENT.md and DIAGRAM.mmd, and add rows to root INTENT.md module map and root ARCHITECTURE.mmd
35
+ - Reference STYLE.md for code standards — your code must comply with all Hard Limits and Structure Rules
36
+
37
+ 3. **Review** — After committing, review your own changes:
38
+ - Run `git diff HEAD~1` to see what changed
39
+ - Check for: bugs, missing error handling, type errors, style inconsistencies
40
+ - Run any verification commands the plan specifies
41
+ - Run the project's linter/typecheck if available
42
+
43
+ 4. **Fix** — If the review surfaces issues:
44
+ - Fix them immediately
45
+ - Commit the fixes
46
+ - Review again
47
+ - Repeat until clean
48
+
49
+ 5. **Continue** — Move to the next task. Do not stop to ask questions. If something is ambiguous, make the best technical decision and document it in your commit message.
50
+
51
+ ## Rules
52
+
53
+ - NEVER stop to ask for input. Make decisions and keep going.
54
+ - ALWAYS commit after each task (not one big commit at the end).
55
+ - ALWAYS review after each commit. The review-fix loop is not optional.
56
+ - Follow the plan's steps exactly — don't improvise unless the plan is clearly wrong.
57
+ - Stay in your worktree. Don't touch files outside your assigned scope.
58
+ - If a verification step fails and you can't fix it in 3 attempts, note it in a commit message and move on.
59
+ - Run tests/build after each task if the project supports it.
60
+ - Read STYLE.md at the project root before writing code. Follow all Hard Limits and Structure Rules.
61
+ - Every commit must include: code changes + tests + INTENT.md update + DIAGRAM.mmd update. A commit without documentation updates is incomplete.
62
+ ```
63
+
64
+ ## Model Selection
65
+
66
+ Pass the `execution` model from ftm-config as the `model` parameter when spawning dispatch agents. If the profile specifies `inherit`, omit the `model` parameter.
@@ -0,0 +1,73 @@
1
+ # Phase 5.5 — Codex Gate (Wave Boundary Validation)
2
+
3
+ ## When to Invoke
4
+
5
+ - After EVERY wave completes and is merged — this is the heavy validation gate
6
+ - For single-task plans, invoke on task completion instead of wave completion
7
+
8
+ ## Inputs for ftm-codex-gate
9
+
10
+ - `file_list`: All files changed across the wave (`git diff --name-only` against pre-wave state)
11
+ - `acceptance_criteria`: Combined acceptance criteria from all tasks in the wave
12
+ - `wave_context`: Summary of what the wave accomplished (task titles + brief descriptions)
13
+ - `project_root`: The project working directory
14
+ - `mode`: `"wave"` for multi-task waves, `"single-task"` for single-task runs
15
+
16
+ ## Result Interpretation
17
+
18
+ **PASS (no issues found):**
19
+ - Log in PROGRESS.md: "Codex gate PASSED — 0 issues"
20
+ - Proceed to next wave (or Phase 6 if this was the last wave)
21
+
22
+ **PASS_WITH_FIXES (issues found and auto-fixed by Codex):**
23
+ - Codex committed fixes directly — review the fix commits
24
+ - Diff each fix commit against INTENT.md entries for the affected functions
25
+ - No INTENT.md conflict → accept the fixes, log in PROGRESS.md and DEBUG.md, proceed
26
+ - INTENT.md conflict detected → see INTENT.md Conflict Resolution below
27
+
28
+ **FAIL (issues Codex could not fix):**
29
+ - Attempt to fix them yourself (you have full context from the wave)
30
+ - If fixed, commit and re-run the Codex gate
31
+ - If unresolved after 2 attempts, report to user:
32
+ ```
33
+ Codex gate FAILED for Wave [N] — manual intervention needed:
34
+ - [remaining issue 1]
35
+ - [remaining issue 2]
36
+ Codex attempted [N] fixes but these remain unresolved.
37
+ ```
38
+ Wait for user input before continuing.
39
+
40
+ ## INTENT.md Conflict Resolution
41
+
42
+ A conflict exists when Codex's fix changes a function's behavior, reverts a deliberate choice, or changes a signature that INTENT.md documents.
43
+
44
+ **Step 1 — Detect:** Compare the Codex fix diff against the INTENT.md entry for the affected function.
45
+
46
+ **Step 2 — Invoke ftm-council** with this structured payload:
47
+ ```
48
+ CONFLICT TYPE: Codex fix contradicts INTENT.md
49
+
50
+ ORIGINAL INTENT (from INTENT.md):
51
+ [paste the full INTENT.md entry for the affected function]
52
+
53
+ CODEX'S CHANGE:
54
+ [paste the diff of what Codex changed]
55
+
56
+ CODEX'S REASONING:
57
+ [paste Codex's explanation from the gate results]
58
+
59
+ THE CODE IN QUESTION:
60
+ [file path and relevant code section]
61
+
62
+ DEBUG.md HISTORY:
63
+ [paste relevant entries from DEBUG.md so the council doesn't suggest already-failed approaches]
64
+
65
+ QUESTION FOR THE COUNCIL:
66
+ Should we (A) update INTENT.md to match Codex's fix, or (B) revert Codex's fix and keep the original intent?
67
+ ```
68
+
69
+ **Step 3 — Execute the verdict:**
70
+ - Verdict A (update intent): Update the INTENT.md entry. Commit: "Update intent: [function] — council verdict [round N]"
71
+ - Verdict B (revert fix): Revert Codex's fix commit. Commit: "Revert codex fix: [function] — council verdict preserves original intent"
72
+ - Log full decision + reasoning in DEBUG.md
73
+ - Continue to next wave after all conflicts are resolved
@@ -0,0 +1,36 @@
1
+ # Phase 1.5 — Documentation Layer Bootstrap
2
+
3
+ ## Purpose
4
+
5
+ Before dispatching any agents, ensure the project has the required documentation layer. This bootstrap runs once at the start of execution. If all files already exist, skip this phase entirely.
6
+
7
+ ## Files to Check and Create
8
+
9
+ **1. INTENT.md** (project root)
10
+
11
+ If missing, bootstrap from the plan's Vision and Architecture Decisions sections. Use the ftm-intent skill's root template format.
12
+
13
+ **2. ARCHITECTURE.mmd** (project root)
14
+
15
+ If missing, bootstrap by scanning the codebase for modules and their import relationships. Use the ftm-diagram skill's root template format.
16
+
17
+ **3. STYLE.md** (project root)
18
+
19
+ If missing, copy from `~/.claude/skills/ftm-executor/references/STYLE-TEMPLATE.md` into the project root.
20
+
21
+ **4. DEBUG.md** (project root)
22
+
23
+ If missing, create with this header:
24
+
25
+ ```markdown
26
+ # Debug Log
27
+
28
+ Failed approaches and their outcomes. Append here — never retry what's already logged.
29
+ ```
30
+
31
+ ## Bootstrap Rules
32
+
33
+ - Check all four files first, then create only the ones that are missing
34
+ - Do not overwrite existing files — presence check only
35
+ - Creation order: STYLE.md (copy) → DEBUG.md (header only) → INTENT.md (plan-derived) → ARCHITECTURE.mmd (scan-derived)
36
+ - Bootstrap content is minimal scaffolding — agents will expand it as they work
@@ -0,0 +1,44 @@
1
+ # Phase 0.7 — Model Profile Loading
2
+
3
+ ## Reading ftm-config.yml
4
+
5
+ Read `~/.claude/ftm-config.yml` to determine which models to use when spawning agents. If the file doesn't exist, use these balanced defaults:
6
+
7
+ | Role | Default Model |
8
+ |------|--------------|
9
+ | Planning agents | opus |
10
+ | Execution agents | sonnet |
11
+ | Review/audit agents | sonnet |
12
+
13
+ ## Model Assignment by Phase
14
+
15
+ When spawning agents in subsequent phases, pass the `model` parameter based on role:
16
+
17
+ | Phase | Agent Role | Model Key |
18
+ |-------|-----------|-----------|
19
+ | Phase 0.5 (plan checking) | Planning | `planning` |
20
+ | Phase 2 (team assembly) | Planning | `planning` |
21
+ | Phase 4 (task execution) | Execution | `execution` |
22
+ | Phase 4.5 (audit) | Review | `review` |
23
+
24
+ If the profile specifies `inherit` for a role, omit the `model` parameter entirely — the agent uses the session default.
25
+
26
+ ## Example ftm-config.yml Structure
27
+
28
+ ```yaml
29
+ active_profile: balanced
30
+
31
+ profiles:
32
+ balanced:
33
+ planning: opus
34
+ execution: sonnet
35
+ review: sonnet
36
+ fast:
37
+ planning: sonnet
38
+ execution: sonnet
39
+ review: sonnet
40
+ quality:
41
+ planning: opus
42
+ execution: opus
43
+ review: opus
44
+ ```
@@ -0,0 +1,66 @@
1
+ # Progress Tracking — PROGRESS.md Template and Update Rules
2
+
3
+ ## Enabling Progress Tracking
4
+
5
+ If `progress_tracking` is enabled in `~/.claude/ftm-config.yml` (default: true), create `PROGRESS.md` in the project root at the start of Phase 3.5.
6
+
7
+ ## Initial File Template
8
+
9
+ Create the file with this structure, filling in plan details:
10
+
11
+ ```markdown
12
+ # FTM Executor — Progress
13
+
14
+ **Plan:** [plan title]
15
+ **Started:** [timestamp]
16
+ **Status:** IN PROGRESS
17
+
18
+ ## Execution Summary
19
+ | Wave | Tasks | Status | Started | Completed |
20
+ |------|-------|--------|---------|-----------|
21
+ | 1 | [task list] | PENDING | — | — |
22
+ | 2 | [task list] | PENDING | — | — |
23
+ | ... | | | | |
24
+
25
+ ## Task Status
26
+ | # | Title | Agent | Status | Audit | Notes |
27
+ |---|-------|-------|--------|-------|-------|
28
+ | 1 | [title] | [agent] | PENDING | — | |
29
+ | 2 | [title] | [agent] | PENDING | — | |
30
+ | ... | | | | | |
31
+
32
+ ## Activity Log
33
+ [reverse chronological — newest first]
34
+ ```
35
+
36
+ ## Update Events
37
+
38
+ Update PROGRESS.md at these events:
39
+
40
+ - **Wave starts** → update wave status to `IN PROGRESS`, add timestamp to Started column
41
+ - **Task agent returns** → update task status to `COMPLETE` or `FAILED`, add audit result
42
+ - **Wave completes** → update wave status to `COMPLETE`, add timestamp to Completed column
43
+ - **Merge completes** → add to activity log
44
+ - **Errors/blockers** → add to activity log with details
45
+
46
+ ## Activity Log Format
47
+
48
+ Each entry uses this format:
49
+ ```
50
+ ### [HH:MM] [event type]
51
+ [brief description]
52
+ ```
53
+
54
+ Example entries (newest first):
55
+ ```
56
+ ### 14:32 Wave 1 complete
57
+ Tasks 1-4 merged to main. All audits passed. 2 auto-fixes applied.
58
+
59
+ ### 14:15 Task 3 audit — auto-fix
60
+ Added missing import for UserPreferences in SettingsView.tsx
61
+
62
+ ### 13:45 Wave 1 started
63
+ Dispatching 4 agents in parallel: frontend (tasks 1,2), backend (task 3), testing (task 4)
64
+ ```
65
+
66
+ This file is for human consumption — the user can check it at any time without interrupting execution. Keep entries concise and informative.