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,302 @@
1
+ ---
2
+ name: ftm-codex-gate
3
+ description: Codex CLI integration gate for adversarial code validation. Invokes codex exec --yolo --ephemeral with gpt-5.4 to form test scenarios, review code quality, fix failures, and enforce STYLE.md patterns. Use when ftm-executor needs Codex validation at wave boundaries or task completion, or when user says "codex gate", "run codex", "validate with codex". Not for direct user interaction — primarily auto-invoked by ftm-executor.
4
+ ---
5
+
6
+ ## Events
7
+
8
+ ### Emits
9
+ - `review_complete` — when Codex finishes analysis and a PASS, PASS_WITH_FIXES, or FAIL verdict is produced
10
+ - `issue_found` — when Codex identifies a quality violation, INTENT.md conflict, or test failure in the reviewed files
11
+ - `task_completed` — when the gate run concludes and results are returned to the calling skill
12
+
13
+ ### Listens To
14
+ - `code_committed` — run adversarial validation at wave boundaries after commits land in the executor's worktree
15
+
16
+ ## Blackboard Read
17
+
18
+ Before starting, load context from the blackboard:
19
+
20
+ 1. Read `~/.claude/ftm-state/blackboard/context.json` — check current_task, recent_decisions, active_constraints
21
+ 2. Read `~/.claude/ftm-state/blackboard/experiences/index.json` — filter entries by tags matching "validation", "codex", or "review"
22
+ 3. Load top 3-5 matching experience files for patterns in what Codex commonly flags or auto-fixes
23
+ 4. Read `~/.claude/ftm-state/blackboard/patterns.json` — check recurring_issues for common validation failures and execution_patterns for typical fix types
24
+
25
+ If index.json is empty or no matches found, proceed normally without experience-informed shortcuts.
26
+
27
+ # Codex Gate
28
+
29
+ This skill is the integration layer between ftm-executor and the Codex CLI. It constructs adversarial validation prompts, runs them through `codex exec`, captures structured output, and returns results to the calling skill. It does not interact with the user directly — it is invoked at wave boundaries or task completion.
30
+
31
+ ---
32
+
33
+ ## Inputs
34
+
35
+ Expect these inputs from the calling skill (ftm-executor). If any are missing, ask for them before proceeding.
36
+
37
+ - `file_list` — List of changed files to review (absolute paths)
38
+ - `acceptance_criteria` — The acceptance criteria from the plan tasks in this wave
39
+ - `wave_context` — A summary of what this wave accomplished
40
+ - `project_root` — The working directory path (absolute)
41
+ - `mode` — `"wave"` (default) or `"single-task"`
42
+
43
+ ---
44
+
45
+ ## Step 1: Read Context Files
46
+
47
+ Read the following files from `project_root` before constructing the Codex prompt:
48
+
49
+ 1. `{project_root}/INTENT.md` (root) — Provides function-level context on what each piece of code should do
50
+ 2. `{project_root}/STYLE.md` — Provides code standards and AI-ergonomic patterns Codex must enforce
51
+ 3. For each file in `file_list`, check if a module-level `INTENT.md` exists alongside it (e.g. `src/auth/INTENT.md`) and read it if present
52
+
53
+ If either root file is missing, note it in the prompt to Codex and continue — do not abort.
54
+
55
+ ---
56
+
57
+ ## Step 2: Determine Mode
58
+
59
+ - If `mode` is `"wave"`, use broad wave-level context in the prompt (all files together, full acceptance criteria, wave summary)
60
+ - If `mode` is `"single-task"`, scope the prompt tightly to the single task's files and criteria only
61
+
62
+ ---
63
+
64
+ ## Step 3: Construct the Codex Prompt
65
+
66
+ Build a prompt string using the template below. Substitute all `{variables}` before passing to Codex.
67
+
68
+ ```
69
+ You are an adversarial code reviewer for a software project. Your job is to break the implementation, find edge cases, enforce code standards, and leave the codebase cleaner than you found it.
70
+
71
+ ## Context
72
+
73
+ Mode: {mode}
74
+ Wave summary: {wave_context}
75
+
76
+ ## Acceptance Criteria
77
+
78
+ {acceptance_criteria}
79
+
80
+ ## Files Changed
81
+
82
+ {file_list — one per line}
83
+
84
+ ## Reference Documents
85
+
86
+ ### INTENT.md (root)
87
+ {contents of root INTENT.md, or "Not found — skip INTENT validation"}
88
+
89
+ ### STYLE.md
90
+ {contents of STYLE.md, or "Not found — skip style enforcement"}
91
+
92
+ {if module-level INTENT.md files were found, include each one with a header like:}
93
+ ### INTENT.md ({module path})
94
+ {contents}
95
+
96
+ ## Your Tasks — execute all of these in order
97
+
98
+ 1. Read every file in the file list. Understand what each function does and what it is supposed to do per INTENT.md.
99
+
100
+ 2. Form adversarial test scenarios. Think about:
101
+ - Edge cases the happy-path tests don't cover
102
+ - Inputs that should fail gracefully but might not
103
+ - Race conditions, off-by-one errors, null/undefined handling
104
+ - Boundary conditions in the acceptance criteria
105
+ - Any place INTENT.md says a function should do X but the code does Y
106
+
107
+ 3. Run the tests. Fix every failure you find. Commit each fix separately with a descriptive message (e.g. "fix: handle null user in auth guard").
108
+
109
+ 4. Review code quality against STYLE.md:
110
+ - Flag any function over 50 lines
111
+ - Flag any file over 1000 lines
112
+ - Flag more than 3 levels of nesting
113
+ - Flag barrel index.ts re-exports
114
+ - Flag unclear naming that requires a comment to explain
115
+
116
+ 5. Fix any STYLE.md violations. Commit each fix separately.
117
+
118
+ 6. Append a summary of all findings and fixes to DEBUG.md at the project root. Use this format:
119
+ ### Codex Gate — {timestamp}
120
+ **Wave**: {wave_context summary, one line}
121
+ **Fixes**: [list each fix with commit hash and description]
122
+ **Quality issues**: [list each issue found, whether fixed or not]
123
+ **INTENT.md conflicts**: [list any place code diverged from INTENT.md]
124
+
125
+ 7. Write your structured output summary to the output file. Use exactly this format:
126
+
127
+ ## Codex Gate Results
128
+
129
+ **Status**: PASS | PASS_WITH_FIXES | FAIL
130
+ **Tests formed**: [count]
131
+ **Tests passed**: [count]
132
+ **Fixes applied**: [count]
133
+ **Quality issues**: [count]
134
+
135
+ ### Fixes Applied
136
+ - [commit hash]: [description]
137
+
138
+ ### Remaining Issues
139
+ - [file:line] — [description]
140
+
141
+ ### INTENT.md Conflicts
142
+ - [conflict description] — [affected function] — [what you changed vs what INTENT.md says]
143
+
144
+ Status rules:
145
+ - PASS: no failures, no quality issues
146
+ - PASS_WITH_FIXES: failures or quality issues found and resolved
147
+ - FAIL: failures remain that you could not fix
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Step 4: Generate Timestamp and Output Path
153
+
154
+ Generate a Unix timestamp for the output file path to avoid collisions:
155
+
156
+ ```
157
+ TIMESTAMP=$(date +%s)
158
+ OUTPUT_FILE="/tmp/codex-result-${TIMESTAMP}.md"
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Step 5: Construct and Run the Command
164
+
165
+ Assemble the full command using the prompt from Step 3. Pass the prompt as the positional argument to `codex exec`.
166
+
167
+ Base command template:
168
+ ```
169
+ codex exec --yolo --ephemeral -m "gpt-5.4" -c model_reasoning_effort="high" -o {OUTPUT_FILE} "{prompt}"
170
+ ```
171
+
172
+ Full invocation example (run via Bash):
173
+ ```bash
174
+ TIMESTAMP=$(date +%s)
175
+ OUTPUT_FILE="/tmp/codex-result-${TIMESTAMP}.md"
176
+ codex exec --yolo --ephemeral \
177
+ -m "gpt-5.4" \
178
+ -c model_reasoning_effort="high" \
179
+ -o "$OUTPUT_FILE" \
180
+ "$CODEX_PROMPT"
181
+ ```
182
+
183
+ Set a timeout of 600 seconds. If Codex does not complete within 600s, move to Step 6 with whatever partial output exists.
184
+
185
+ **Flags reference:**
186
+ - `--yolo` — No sandbox, no approval prompts; Claude Code is the outer sandbox
187
+ - `--ephemeral` — No session state persisted on the Codex side
188
+ - `-m "gpt-5.4"` — Model to use
189
+ - `-c model_reasoning_effort="high"` — High reasoning effort for thorough analysis
190
+ - `-o {OUTPUT_FILE}` — Write structured output to this file for clean capture
191
+
192
+ ---
193
+
194
+ ## Step 6: Error Handling
195
+
196
+ Handle each failure case before reading the output file.
197
+
198
+ **Codex not found:**
199
+ ```
200
+ If `which codex` returns nothing or the command exits with "command not found":
201
+ Return: "Codex CLI not found. Install with: npm install -g @openai/codex — then re-run the gate."
202
+ Do not proceed.
203
+ ```
204
+
205
+ **Timeout (>600s):**
206
+ ```
207
+ If the command exceeds 600 seconds:
208
+ Check if OUTPUT_FILE exists and has content.
209
+ If yes: proceed to Step 7 with a note "PARTIAL RESULTS — Codex timed out at 600s"
210
+ If no: return FAIL with message "Codex timed out with no output captured."
211
+ ```
212
+
213
+ **Non-zero exit code:**
214
+ ```
215
+ Capture stderr. Include it in the results under "Remaining Issues" as:
216
+ - [stderr content] — Codex exited with code {exit_code}
217
+ Proceed to Step 7 to read any partial output.
218
+ ```
219
+
220
+ **Output file empty or missing:**
221
+ ```
222
+ Return structured result with Status: FAIL and message:
223
+ "Codex output file not found or empty at {OUTPUT_FILE}. Codex may have crashed or produced no output."
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Step 7: Read and Parse the Output File
229
+
230
+ Read `OUTPUT_FILE`. Extract the structured block that begins with `## Codex Gate Results`.
231
+
232
+ Return the full structured summary to the calling skill (ftm-executor) in this exact format:
233
+
234
+ ```
235
+ ## Codex Gate Results
236
+
237
+ **Status**: PASS | PASS_WITH_FIXES | FAIL
238
+ **Tests formed**: [count]
239
+ **Tests passed**: [count]
240
+ **Fixes applied**: [count]
241
+ **Quality issues**: [count]
242
+
243
+ ### Fixes Applied
244
+ - [commit hash]: [description]
245
+
246
+ ### Remaining Issues
247
+ - [file:line] — [description]
248
+
249
+ ### INTENT.md Conflicts
250
+ - [conflict description] — [affected function] — [what Codex changed vs what INTENT.md says]
251
+ ```
252
+
253
+ If the output file does not contain the expected format, return the raw file content and flag it as unstructured with Status: FAIL.
254
+
255
+ ---
256
+
257
+ ## Step 8: Return to Caller
258
+
259
+ Pass the structured result back to ftm-executor. Do not post to any external system, do not notify the user directly unless ftm-executor explicitly delegates that to this skill.
260
+
261
+ If Status is FAIL or PASS_WITH_FIXES, include the full "Remaining Issues" and "INTENT.md Conflicts" sections so ftm-executor can decide whether to retry, escalate, or continue to the next wave.
262
+
263
+ ---
264
+
265
+ ## Invocation Modes Summary
266
+
267
+ | Mode | Scope | Prompt focus |
268
+ |------|-------|-------------|
269
+ | `wave` (default) | All files from completed wave | Full wave context, all acceptance criteria, broader adversarial sweep |
270
+ | `single-task` | Files from one task | Tight scope, single task criteria, targeted adversarial cases |
271
+
272
+ ---
273
+
274
+ ## Blackboard Write
275
+
276
+ After completing, update the blackboard:
277
+
278
+ 1. Update `~/.claude/ftm-state/blackboard/context.json`:
279
+ - Set current_task status to "complete"
280
+ - Append decision summary to recent_decisions including the gate verdict (cap at 10)
281
+ - Update session_metadata.skills_invoked and last_updated
282
+ 2. Write an experience file to `~/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json` capturing gate mode, verdict, tests formed/passed, fixes applied, and any INTENT.md conflicts found
283
+ 3. Update `~/.claude/ftm-state/blackboard/experiences/index.json` with the new entry
284
+ 4. Emit `task_completed` event
285
+
286
+ ## Error Output Template
287
+
288
+ When returning an error before Codex runs:
289
+
290
+ ```
291
+ ## Codex Gate Results
292
+
293
+ **Status**: FAIL
294
+ **Error**: [description]
295
+ **Tests formed**: 0
296
+ **Tests passed**: 0
297
+ **Fixes applied**: 0
298
+ **Quality issues**: 0
299
+
300
+ ### Remaining Issues
301
+ - [error detail]
302
+ ```
@@ -0,0 +1,2 @@
1
+ name: ftm-codex-gate
2
+ description: Codex CLI integration gate for adversarial code validation. Invokes codex exec --yolo --ephemeral with gpt-5.4 to form test scenarios, review code quality, fix failures, and enforce STYLE.md patterns. Use when ftm-executor needs Codex validation at wave boundaries or task completion, or when user says "codex gate", "run codex", "validate with codex". Not for direct user interaction — primarily auto-invoked by ftm-executor.
@@ -0,0 +1,310 @@
1
+ ---
2
+ name: ftm-config
3
+ description: Configure ftm skill settings including model profiles, execution preferences, and defaults. Use when user says "ftm config", "ftm settings", "set ftm profile", "ftm model", or wants to change how ftm skills behave.
4
+ ---
5
+
6
+ ## Events
7
+
8
+ ### Emits
9
+ - `task_completed` — when a configuration change is validated, saved, and confirmed to the user
10
+
11
+ ### Listens To
12
+ (none — ftm-config is explicitly invoked by the user and does not respond to events)
13
+
14
+ # FTM Config
15
+
16
+ Manage configuration for all ftm skills, including model profiles, execution preferences, and session settings.
17
+
18
+ ## Config File Location
19
+
20
+ `~/.claude/ftm-config.yml`
21
+
22
+ This is the single source of truth for all ftm skill behavior. Every ftm skill reads from this file at startup.
23
+
24
+ ## Config Schema
25
+
26
+ ```yaml
27
+ # FTM Skills Configuration
28
+ # Edit this file or use /ftm-config to modify settings
29
+
30
+ # Model profiles control which model is used at each stage
31
+ # Options: opus, sonnet, haiku, inherit (use session default)
32
+ profile: balanced # quality | balanced | budget | custom | inherit
33
+
34
+ profiles:
35
+ quality:
36
+ planning: opus # brainstorm, research, plan generation
37
+ execution: opus # agent task implementation
38
+ review: sonnet # audit, debug review, council synthesis
39
+
40
+ balanced:
41
+ planning: opus
42
+ execution: sonnet
43
+ review: sonnet
44
+
45
+ budget:
46
+ planning: sonnet
47
+ execution: sonnet
48
+ review: haiku
49
+
50
+ inherit:
51
+ planning: inherit
52
+ execution: inherit
53
+ review: inherit
54
+
55
+ custom:
56
+ planning: opus
57
+ execution: sonnet
58
+ review: haiku
59
+
60
+ # Execution preferences
61
+ execution:
62
+ max_parallel_agents: 5 # max agents dispatched simultaneously
63
+ auto_audit: true # run ftm-audit after each executor task
64
+ progress_tracking: true # write PROGRESS.md during execution
65
+
66
+ # Session management
67
+ session:
68
+ auto_pause_on_exit: false # automatically save state when conversation ends
69
+ state_retention_days: 7 # archive states older than this
70
+ ```
71
+
72
+ ## Instructions
73
+
74
+ ### Step 1: Read Current Config
75
+
76
+ Read `~/.claude/ftm-config.yml`. If it does not exist, create it with the default configuration (balanced profile active, all defaults as shown in the schema above). Use the file-creator pattern or Write tool to create the file.
77
+
78
+ ### Step 2: Determine Intent
79
+
80
+ Parse the user's input to determine what they want:
81
+
82
+ - **No arguments** (bare `/ftm-config`): Display current configuration.
83
+ - **`set profile <name>`**: Change the active profile.
84
+ - **`set profile custom`**: Activate the custom profile, then interactively ask which model to use for each stage (planning, execution, review).
85
+ - **`set <dotted.path> <value>`**: Update a specific setting (e.g., `set execution.max_parallel_agents 3`).
86
+ - **`enable <skill-name>`** / **`disable <skill-name>`**: Enable or disable a skill in ftm-mind routing.
87
+ - **`reset`**: Restore all settings to defaults.
88
+ - **`show profiles`**: Display all available profiles side by side.
89
+ - **`show skills`**: Display all skills and their enabled/disabled status.
90
+
91
+ ### Step 3: Display Current Configuration (No Args)
92
+
93
+ When displaying the config, format it clearly:
94
+
95
+ ```
96
+ FTM Configuration
97
+ ====================
98
+
99
+ Active Profile: balanced
100
+
101
+ Planning → opus (brainstorm, research, plan generation)
102
+ Execution → sonnet (agent task implementation)
103
+ Review → sonnet (audit, debug review, council synthesis)
104
+
105
+ Execution Settings:
106
+ Max Parallel Agents: 5
107
+ Auto Audit: true
108
+ Progress Tracking: true
109
+
110
+ Session Settings:
111
+ Auto Pause on Exit: false
112
+ State Retention Days: 7
113
+ ```
114
+
115
+ ### Step 4: Apply Changes
116
+
117
+ When the user requests a change:
118
+
119
+ 1. **Validate inputs**:
120
+ - Model names must be one of: `opus`, `sonnet`, `haiku`, `inherit`. Reject anything else with a clear error.
121
+ - Profile names must be one of: `quality`, `balanced`, `budget`, `custom`, `inherit`. Reject anything else.
122
+ - Numeric values must be positive integers where applicable.
123
+ - Boolean values must be `true` or `false`.
124
+
125
+ 2. **Show before/after**:
126
+ ```
127
+ Changing active profile:
128
+ Before: balanced (opus / sonnet / sonnet)
129
+ After: quality (opus / opus / sonnet)
130
+ ```
131
+
132
+ 3. **Save changes**: Write the updated YAML back to `~/.claude/ftm-config.yml`.
133
+
134
+ 4. **Confirm**: Display the updated configuration section that changed.
135
+
136
+ ### Step 5: Handle Custom Profile
137
+
138
+ When the user sets `profile custom`:
139
+
140
+ 1. Show the current custom profile settings.
141
+ 2. Ask: "Which model for **planning** (brainstorm, research)? [opus/sonnet/haiku/inherit]"
142
+ 3. Ask: "Which model for **execution** (agent tasks, code writing)? [opus/sonnet/haiku/inherit]"
143
+ 4. Ask: "Which model for **review** (audit, debug, council)? [opus/sonnet/haiku/inherit]"
144
+ 5. Validate each answer, save, and display the final custom profile.
145
+
146
+ If the user provides all three in one line (e.g., `set profile custom opus haiku sonnet`), parse them positionally as planning/execution/review without asking interactively.
147
+
148
+ ### Step 6: Handle Reset
149
+
150
+ When the user says `reset`:
151
+
152
+ 1. Show current configuration.
153
+ 2. Confirm: "This will restore all ftm settings to defaults. Proceed?"
154
+ 3. If confirmed, write the default configuration to `~/.claude/ftm-config.yml`.
155
+ 4. Display the restored defaults.
156
+
157
+ ## Valid Model Options
158
+
159
+ | Model | Description | Best For |
160
+ |-------|-------------|----------|
161
+ | `opus` | Most capable, highest quality | Complex planning, architecture decisions |
162
+ | `sonnet` | Balanced capability and speed | General execution, code writing, reviews |
163
+ | `haiku` | Fastest, most efficient | Simple reviews, quick checks, budget tasks |
164
+ | `inherit` | Use session default | When you want the conversation's current model |
165
+
166
+ ## Valid Profiles
167
+
168
+ | Profile | Planning | Execution | Review | Use Case |
169
+ |---------|----------|-----------|--------|----------|
170
+ | `quality` | opus | opus | sonnet | Maximum quality, complex projects |
171
+ | `balanced` | opus | sonnet | sonnet | Good default for most work |
172
+ | `budget` | sonnet | sonnet | haiku | Token-efficient, simpler tasks |
173
+ | `inherit` | inherit | inherit | inherit | Use whatever model the session runs |
174
+ | `custom` | (user-defined) | (user-defined) | (user-defined) | Full user control |
175
+
176
+ ## How Other FTM Skills Use This Config
177
+
178
+ All ftm skills should read `~/.claude/ftm-config.yml` at the start of execution to determine which model to use when spawning agents.
179
+
180
+ ### Reading the Config
181
+
182
+ At the beginning of any ftm skill execution:
183
+
184
+ 1. Read `~/.claude/ftm-config.yml`.
185
+ 2. Look at the `profile` field to determine which profile is active.
186
+ 3. Look up that profile under `profiles.<profile_name>` to get the model for each stage.
187
+ 4. If the config file does not exist, use "balanced" defaults: `opus` for planning, `sonnet` for execution, `sonnet` for review.
188
+
189
+ ### Mapping Stages to FTM Skills
190
+
191
+ | Stage | Config Key | FTM Skills That Use It |
192
+ |-------|-----------|--------------------------|
193
+ | **Planning** | `profiles.<active>.planning` | ftm-brainstorm, ftm (research/plan generation phase) |
194
+ | **Execution** | `profiles.<active>.execution` | ftm-executor (all spawned task agents) |
195
+ | **Review** | `profiles.<active>.review` | ftm-audit, ftm-debug, ftm-council (synthesis phase) |
196
+
197
+ ### Spawning Agents with the Correct Model
198
+
199
+ When spawning agents, use the `model` parameter on the Agent tool:
200
+
201
+ - **For planning agents** (research, brainstorming, plan generation):
202
+ Use the profile's `planning` model.
203
+
204
+ - **For execution agents** (implementing tasks, writing code):
205
+ Use the profile's `execution` model.
206
+
207
+ - **For review agents** (audit, debug review, council synthesis):
208
+ Use the profile's `review` model.
209
+
210
+ If the model value is `"inherit"`, omit the `model` parameter entirely so the agent inherits the session's current model.
211
+
212
+ ### Example Resolution
213
+
214
+ Given this config:
215
+ ```yaml
216
+ profile: balanced
217
+ profiles:
218
+ balanced:
219
+ planning: opus
220
+ execution: sonnet
221
+ review: sonnet
222
+ ```
223
+
224
+ - `ftm-brainstorm` spawns its research agents with `model: opus`
225
+ - `ftm-executor` spawns task agents with `model: sonnet`
226
+ - `ftm-audit` spawns review agents with `model: sonnet`
227
+ - `ftm-council` spawns synthesis agents with `model: sonnet`
228
+
229
+ ### Execution Preferences
230
+
231
+ Other ftm skills should also respect:
232
+
233
+ - **`execution.max_parallel_agents`**: Do not spawn more agents simultaneously than this number. Queue excess agents.
234
+ - **`execution.auto_audit`**: If `true`, `ftm-executor` should automatically invoke `ftm-audit` after each task completes.
235
+ - **`execution.progress_tracking`**: If `true`, write status updates to `PROGRESS.md` in the workspace during execution.
236
+
237
+ ### Session Preferences
238
+
239
+ - **`session.auto_pause_on_exit`**: If `true`, ftm skills should automatically save state (like `ftm-pause`) when the conversation is ending.
240
+ - **`session.state_retention_days`**: When resuming, archive or clean up state files older than this many days.
241
+
242
+ ## Examples
243
+
244
+ ### View current config
245
+ ```
246
+ User: /ftm-config
247
+ → Displays full current configuration
248
+ ```
249
+
250
+ ### Switch to quality profile
251
+ ```
252
+ User: /ftm-config set profile quality
253
+ → Shows before/after, saves change
254
+ ```
255
+
256
+ ### Set custom profile with specific models
257
+ ```
258
+ User: /ftm-config set profile custom opus haiku sonnet
259
+ → Sets custom profile: planning=opus, execution=haiku, review=sonnet
260
+ ```
261
+
262
+ ### Change a specific setting
263
+ ```
264
+ User: /ftm-config set execution.max_parallel_agents 3
265
+ → Updates max parallel agents from 5 to 3
266
+ ```
267
+
268
+ ### Disable auto-audit
269
+ ```
270
+ User: /ftm-config set execution.auto_audit false
271
+ → Disables automatic audit after executor tasks
272
+ ```
273
+
274
+ ### Disable a skill
275
+ ```
276
+ User: /ftm-config disable ftm-council
277
+ → Sets skills.ftm-council.enabled: false — ftm-mind will no longer route to it
278
+ ```
279
+
280
+ ### Show skill status
281
+ ```
282
+ User: /ftm-config show skills
283
+ → Displays all skills with enabled/disabled status
284
+ ```
285
+
286
+ ### Reset to defaults
287
+ ```
288
+ User: /ftm-config reset
289
+ → Confirms, then restores all settings to defaults
290
+ ```
291
+
292
+ ### Show all profiles
293
+ ```
294
+ User: /ftm-config show profiles
295
+ → Displays table of all profiles with their model assignments
296
+ ```
297
+
298
+ ## Troubleshooting
299
+
300
+ ### Config file is missing
301
+ The skill will create `~/.claude/ftm-config.yml` with default settings automatically. No action needed.
302
+
303
+ ### Invalid model name
304
+ Only `opus`, `sonnet`, `haiku`, and `inherit` are valid. The skill will reject other values and show the valid options.
305
+
306
+ ### Config file is malformed
307
+ If the YAML cannot be parsed, the skill will back up the broken file as `~/.claude/ftm-config.yml.bak` and create a fresh default config.
308
+
309
+ ### Changes not taking effect
310
+ Other ftm skills read the config at startup. If a ftm skill is already running, it will use the config that was active when it started. Changes apply to the next invocation.
@@ -0,0 +1,80 @@
1
+ # FTM Skills Configuration
2
+ # Edit this file or use /ftm-config to modify settings
3
+
4
+ # Model profiles control which model is used at each stage
5
+ # Options: opus, sonnet, haiku, inherit (use session default)
6
+ profile: balanced # quality | balanced | budget | custom | inherit
7
+
8
+ profiles:
9
+ quality:
10
+ planning: opus # brainstorm, research, plan generation
11
+ execution: opus # agent task implementation
12
+ review: sonnet # audit, debug review, council synthesis
13
+
14
+ balanced:
15
+ planning: opus
16
+ execution: sonnet
17
+ review: sonnet
18
+
19
+ budget:
20
+ planning: sonnet
21
+ execution: sonnet
22
+ review: haiku
23
+
24
+ inherit:
25
+ planning: inherit
26
+ execution: inherit
27
+ review: inherit
28
+
29
+ custom:
30
+ planning: opus
31
+ execution: sonnet
32
+ review: haiku
33
+
34
+ # Execution preferences
35
+ execution:
36
+ max_parallel_agents: 5 # max agents dispatched simultaneously
37
+ per_skill_overrides: # skills read their own override, fall back to global
38
+ ftm-researcher: 10
39
+ ftm-executor: 8
40
+ ftm-debug: 6
41
+ ftm-brainstorm: 3 # fallback if researcher unavailable
42
+ auto_audit: true # run ftm-audit after each executor task
43
+ progress_tracking: true # write PROGRESS.md during execution
44
+ approval_mode: plan_first # plan_first | always_ask
45
+ # plan_first: every task gets a plan, micro tasks get inline plans
46
+ # always_ask: always present full plan, even for micro tasks
47
+ tdd_mode: false # when true, agents must write tests before implementation
48
+ # spec reviewer enforces RED-GREEN-REFACTOR compliance
49
+
50
+ # Two-stage review — runs after each task agent completes, before ftm-audit
51
+ review:
52
+ spec_reviewer_model: haiku # fast, cheap — checks spec compliance only
53
+ quality_reviewer_model: opus # thorough — checks code quality and bug risk
54
+ skip_quality_review: false # set true to run spec review only (faster execution)
55
+
56
+ # Skill enable/disable — set enabled: false to prevent ftm-mind from routing to a skill
57
+ skills:
58
+ ftm-brainstorm: { enabled: true }
59
+ ftm-executor: { enabled: true }
60
+ ftm-debug: { enabled: true }
61
+ ftm-audit: { enabled: true }
62
+ ftm-council: { enabled: true }
63
+ ftm-codex-gate: { enabled: true }
64
+ ftm-intent: { enabled: true }
65
+ ftm-diagram: { enabled: true }
66
+ ftm-browse: { enabled: true }
67
+ ftm-pause: { enabled: true }
68
+ ftm-resume: { enabled: true }
69
+ ftm-upgrade: { enabled: true }
70
+ ftm-retro: { enabled: true }
71
+ ftm-config: { enabled: true }
72
+ ftm-git: { enabled: true }
73
+ ftm-mind: { enabled: true }
74
+ ftm-researcher: { enabled: true } # deep parallel research engine
75
+ ftm-map: { enabled: true } # persistent code knowledge graph
76
+
77
+ # Session management
78
+ session:
79
+ auto_pause_on_exit: false # automatically save state when conversation ends
80
+ state_retention_days: 7 # archive states older than this
package/ftm-config.yml ADDED
@@ -0,0 +1,2 @@
1
+ name: ftm-config
2
+ description: Configure ftm skill settings including model profiles, execution preferences, and defaults. Use when user says "ftm config", "ftm settings", "set ftm profile", "ftm model", or wants to change how ftm skills behave.