feed-the-machine 1.0.0 → 1.2.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 (136) hide show
  1. package/bin/generate-manifest.mjs +253 -0
  2. package/bin/install.mjs +134 -4
  3. package/docs/HOOKS.md +243 -0
  4. package/docs/INBOX.md +233 -0
  5. package/ftm/SKILL.md +34 -0
  6. package/ftm-audit/SKILL.md +69 -0
  7. package/ftm-brainstorm/SKILL.md +51 -0
  8. package/ftm-browse/SKILL.md +39 -0
  9. package/ftm-capture/SKILL.md +370 -0
  10. package/ftm-capture.yml +4 -0
  11. package/ftm-codex-gate/SKILL.md +59 -0
  12. package/ftm-config/SKILL.md +35 -0
  13. package/ftm-council/SKILL.md +56 -0
  14. package/ftm-dashboard/SKILL.md +163 -0
  15. package/ftm-debug/SKILL.md +84 -0
  16. package/ftm-diagram/SKILL.md +44 -0
  17. package/ftm-executor/SKILL.md +97 -0
  18. package/ftm-git/SKILL.md +60 -0
  19. package/ftm-inbox/backend/__init__.py +0 -0
  20. package/ftm-inbox/backend/__pycache__/main.cpython-314.pyc +0 -0
  21. package/ftm-inbox/backend/adapters/__init__.py +0 -0
  22. package/ftm-inbox/backend/adapters/_retry.py +64 -0
  23. package/ftm-inbox/backend/adapters/base.py +230 -0
  24. package/ftm-inbox/backend/adapters/freshservice.py +104 -0
  25. package/ftm-inbox/backend/adapters/gmail.py +125 -0
  26. package/ftm-inbox/backend/adapters/jira.py +136 -0
  27. package/ftm-inbox/backend/adapters/registry.py +192 -0
  28. package/ftm-inbox/backend/adapters/slack.py +110 -0
  29. package/ftm-inbox/backend/db/__init__.py +0 -0
  30. package/ftm-inbox/backend/db/connection.py +54 -0
  31. package/ftm-inbox/backend/db/schema.py +78 -0
  32. package/ftm-inbox/backend/executor/__init__.py +7 -0
  33. package/ftm-inbox/backend/executor/engine.py +149 -0
  34. package/ftm-inbox/backend/executor/step_runner.py +98 -0
  35. package/ftm-inbox/backend/main.py +103 -0
  36. package/ftm-inbox/backend/models/__init__.py +1 -0
  37. package/ftm-inbox/backend/models/unified_task.py +36 -0
  38. package/ftm-inbox/backend/planner/__init__.py +6 -0
  39. package/ftm-inbox/backend/planner/__pycache__/__init__.cpython-314.pyc +0 -0
  40. package/ftm-inbox/backend/planner/__pycache__/generator.cpython-314.pyc +0 -0
  41. package/ftm-inbox/backend/planner/__pycache__/schema.cpython-314.pyc +0 -0
  42. package/ftm-inbox/backend/planner/generator.py +127 -0
  43. package/ftm-inbox/backend/planner/schema.py +34 -0
  44. package/ftm-inbox/backend/requirements.txt +5 -0
  45. package/ftm-inbox/backend/routes/__init__.py +0 -0
  46. package/ftm-inbox/backend/routes/__pycache__/plan.cpython-314.pyc +0 -0
  47. package/ftm-inbox/backend/routes/execute.py +186 -0
  48. package/ftm-inbox/backend/routes/health.py +52 -0
  49. package/ftm-inbox/backend/routes/inbox.py +68 -0
  50. package/ftm-inbox/backend/routes/plan.py +271 -0
  51. package/ftm-inbox/bin/launchagent.mjs +91 -0
  52. package/ftm-inbox/bin/setup.mjs +188 -0
  53. package/ftm-inbox/bin/start.sh +10 -0
  54. package/ftm-inbox/bin/status.sh +17 -0
  55. package/ftm-inbox/bin/stop.sh +8 -0
  56. package/ftm-inbox/config.example.yml +55 -0
  57. package/ftm-inbox/package-lock.json +2898 -0
  58. package/ftm-inbox/package.json +26 -0
  59. package/ftm-inbox/postcss.config.js +6 -0
  60. package/ftm-inbox/src/app.css +199 -0
  61. package/ftm-inbox/src/app.html +18 -0
  62. package/ftm-inbox/src/lib/api.ts +166 -0
  63. package/ftm-inbox/src/lib/components/ExecutionLog.svelte +81 -0
  64. package/ftm-inbox/src/lib/components/InboxFeed.svelte +143 -0
  65. package/ftm-inbox/src/lib/components/PlanStep.svelte +271 -0
  66. package/ftm-inbox/src/lib/components/PlanView.svelte +206 -0
  67. package/ftm-inbox/src/lib/components/StreamPanel.svelte +99 -0
  68. package/ftm-inbox/src/lib/components/TaskCard.svelte +190 -0
  69. package/ftm-inbox/src/lib/components/ui/EmptyState.svelte +63 -0
  70. package/ftm-inbox/src/lib/components/ui/KawaiiCard.svelte +86 -0
  71. package/ftm-inbox/src/lib/components/ui/PillButton.svelte +106 -0
  72. package/ftm-inbox/src/lib/components/ui/StatusBadge.svelte +67 -0
  73. package/ftm-inbox/src/lib/components/ui/StreamDrawer.svelte +149 -0
  74. package/ftm-inbox/src/lib/components/ui/ThemeToggle.svelte +80 -0
  75. package/ftm-inbox/src/lib/theme.ts +47 -0
  76. package/ftm-inbox/src/routes/+layout.svelte +76 -0
  77. package/ftm-inbox/src/routes/+page.svelte +401 -0
  78. package/ftm-inbox/static/favicon.png +0 -0
  79. package/ftm-inbox/svelte.config.js +12 -0
  80. package/ftm-inbox/tailwind.config.ts +63 -0
  81. package/ftm-inbox/tsconfig.json +13 -0
  82. package/ftm-inbox/vite.config.ts +6 -0
  83. package/ftm-intent/SKILL.md +44 -0
  84. package/ftm-manifest.json +3794 -0
  85. package/ftm-map/SKILL.md +259 -0
  86. package/ftm-map/scripts/db.py +391 -0
  87. package/ftm-map/scripts/index.py +341 -0
  88. package/ftm-map/scripts/parser.py +455 -0
  89. package/ftm-map/scripts/queries/.gitkeep +0 -0
  90. package/ftm-map/scripts/queries/javascript-tags.scm +23 -0
  91. package/ftm-map/scripts/queries/python-tags.scm +17 -0
  92. package/ftm-map/scripts/queries/typescript-tags.scm +29 -0
  93. package/ftm-map/scripts/query.py +149 -0
  94. package/ftm-map/scripts/requirements.txt +2 -0
  95. package/ftm-map/scripts/setup-hooks.sh +27 -0
  96. package/ftm-map/scripts/setup.sh +45 -0
  97. package/ftm-map/scripts/test_db.py +124 -0
  98. package/ftm-map/scripts/test_parser.py +106 -0
  99. package/ftm-map/scripts/test_query.py +66 -0
  100. package/ftm-map/scripts/tests/fixtures/__init__.py +0 -0
  101. package/ftm-map/scripts/tests/fixtures/sample_project/api.ts +16 -0
  102. package/ftm-map/scripts/tests/fixtures/sample_project/auth.py +15 -0
  103. package/ftm-map/scripts/tests/fixtures/sample_project/utils.js +16 -0
  104. package/ftm-map/scripts/views.py +545 -0
  105. package/ftm-mind/SKILL.md +173 -66
  106. package/ftm-pause/SKILL.md +43 -0
  107. package/ftm-researcher/SKILL.md +275 -0
  108. package/ftm-researcher/evals/agent-diversity.yaml +17 -0
  109. package/ftm-researcher/evals/synthesis-quality.yaml +12 -0
  110. package/ftm-researcher/evals/trigger-accuracy.yaml +39 -0
  111. package/ftm-researcher/references/adaptive-search.md +116 -0
  112. package/ftm-researcher/references/agent-prompts.md +193 -0
  113. package/ftm-researcher/references/council-integration.md +193 -0
  114. package/ftm-researcher/references/output-format.md +203 -0
  115. package/ftm-researcher/references/synthesis-pipeline.md +165 -0
  116. package/ftm-researcher/scripts/score_credibility.py +234 -0
  117. package/ftm-researcher/scripts/validate_research.py +92 -0
  118. package/ftm-resume/SKILL.md +47 -0
  119. package/ftm-retro/SKILL.md +54 -0
  120. package/ftm-routine/SKILL.md +170 -0
  121. package/ftm-state/blackboard/capabilities.json +5 -0
  122. package/ftm-state/blackboard/capabilities.schema.json +27 -0
  123. package/ftm-upgrade/SKILL.md +41 -0
  124. package/ftm-upgrade/scripts/check-version.sh +1 -1
  125. package/ftm-upgrade/scripts/upgrade.sh +1 -1
  126. package/hooks/ftm-blackboard-enforcer.sh +94 -0
  127. package/hooks/ftm-discovery-reminder.sh +90 -0
  128. package/hooks/ftm-drafts-gate.sh +61 -0
  129. package/hooks/ftm-event-logger.mjs +107 -0
  130. package/hooks/ftm-map-autodetect.sh +79 -0
  131. package/hooks/ftm-pending-sync-check.sh +22 -0
  132. package/hooks/ftm-plan-gate.sh +96 -0
  133. package/hooks/ftm-post-commit-trigger.sh +57 -0
  134. package/hooks/settings-template.json +81 -0
  135. package/install.sh +140 -11
  136. package/package.json +12 -2
@@ -0,0 +1,370 @@
1
+ ---
2
+ name: ftm-capture
3
+ description: Extract reusable routines, playbooks, and reference docs from the current session's work. Reads session context (blackboard, daily log, tool history), asks clarifying questions about generalizability, then writes to all three ftm knowledge layers. Use when user says "capture this", "save this as a routine", "make a playbook from this", "ftm capture", "codify this", "turn this into a routine", "extract the pattern", "save what we did", "learn from this", "remember how to do this", "don't make me explain this again".
4
+ ---
5
+
6
+ ## Events
7
+
8
+ ### Emits
9
+ - `capture_complete` — when all three artifacts (routine, playbook, reference doc) are written
10
+ - `experience_recorded` — when the capture is logged to the blackboard experience layer
11
+ - `known_issue_recorded` — when API gotchas or failure workarounds are encoded
12
+
13
+ ### Listens To
14
+ - `task_completed` — can be auto-triggered after task completion to suggest capture
15
+ - `pattern_discovered` — if ftm-retro identifies a recurring workflow, suggest capture
16
+
17
+ # FTM Capture — Session-to-Knowledge Extractor
18
+
19
+ Turns what you just did into reusable automation. Reads the current session's work (blackboard context, daily log, tool calls, experiences), asks 2-4 clarifying questions about generalizability, then writes to all three ftm knowledge layers simultaneously.
20
+
21
+ ## Why This Exists
22
+
23
+ Every time you complete a repeatable workflow (SSO setup, service catalog creation, vendor onboarding, incident response), the knowledge lives only in the conversation. Next session starts from zero. ftm-capture closes this gap by extracting the pattern while context is fresh and writing it to durable storage that ftm-mind, ftm-routine, and eng-buddy can all access.
24
+
25
+ ## Output Artifacts
26
+
27
+ ftm-capture writes to **three locations** simultaneously:
28
+
29
+ | Artifact | Location | Format | Consumer |
30
+ |---|---|---|---|
31
+ | **Routine** | `~/.ftm/routines/{name}.yml` | YAML with phases/steps | `ftm-routine` (executable) |
32
+ | **Playbook** | `~/.claude/eng-buddy/playbooks/{name}.json` | JSON with exact tool params | eng-buddy playbook engine |
33
+ | **Reference Doc** | `~/Documents/Code/panda/docs/playbooks/{name}.md` | Markdown with gotchas | Future agents + humans |
34
+
35
+ All three are kept in sync. The routine is the executable version, the playbook has exact tool parameters, and the reference doc has the context and gotchas.
36
+
37
+ ## Operating Modes
38
+
39
+ ### Mode 1: Explicit Capture (`/ftm capture [name]`)
40
+
41
+ User invokes directly after completing work. This is the primary mode.
42
+
43
+ ### Mode 2: Auto-Suggest (via ftm-retro or ftm-mind)
44
+
45
+ After ftm-retro scores an execution, if it detects a repeatable pattern, it suggests: "This looks like a reusable workflow. Run `/ftm capture` to save it."
46
+
47
+ ftm-mind can also suggest capture when it detects the user doing something they've done before (matching experiences in the blackboard).
48
+
49
+ ### Mode 3: Inline Capture (mid-session)
50
+
51
+ User says "capture this" or "save what we just did" while still working. Capture the completed portion and note what's still in progress.
52
+
53
+ ## Execution Protocol
54
+
55
+ ### Step 1: Gather Session Context
56
+
57
+ Read these files in order:
58
+
59
+ 1. **Blackboard context**: `~/.claude/ftm-state/blackboard/context.json`
60
+ - Extract: `current_task`, `recent_decisions`, `active_constraints`
61
+ 2. **Today's daily log**: `~/.claude/eng-buddy/daily/{today}.md`
62
+ - Extract: completed items, tool calls, blockers encountered, lessons learned
63
+ 3. **Recent experiences**: `~/.claude/ftm-state/blackboard/experiences/index.json`
64
+ - Filter for entries from today's session
65
+ - Load matching experience files for their `lessons` and `decisions_made`
66
+ 4. **Existing routines**: `ls ~/.ftm/routines/` — check if a routine for this workflow already exists
67
+ 5. **Existing playbooks**: `ls ~/.claude/eng-buddy/playbooks/` — check for existing playbook
68
+ 6. **Existing reference docs**: `ls ~/Documents/Code/panda/docs/playbooks/` — check for existing doc
69
+
70
+ If an existing artifact covers this workflow, the capture becomes an **update** not a create. Load the existing version and merge new learnings.
71
+
72
+ ### Step 2: Identify the Pattern
73
+
74
+ From the gathered context, identify:
75
+
76
+ - **Workflow name**: kebab-case identifier (e.g., `sso-full-setup`, `vendor-onboarding`, `incident-response`)
77
+ - **Trigger**: What kicks off this workflow? (ticket type, user request, event)
78
+ - **Phases**: Major stages of the workflow (e.g., "Okta setup", "Freshservice config", "Vendor coordination")
79
+ - **Steps per phase**: Specific actions with tools, parameters, and verification
80
+ - **Decision points**: Where does the workflow branch based on input? (e.g., "SCIM supported?" → yes/no path)
81
+ - **Known issues**: API gotchas, workarounds, things that failed and were fixed
82
+ - **Environment assumptions**: What repo, what API access, what tools are available?
83
+
84
+ ### Step 3: Clarifying Questions (2-4 max)
85
+
86
+ Ask the user focused questions to determine generalizability. DO NOT ask more than 4 questions. Pick the most important from:
87
+
88
+ **Generalizability questions:**
89
+ - "Is this always [SAML/OIDC] or does it vary by vendor?"
90
+ - "Are the approvers always [names] or does that change per app?"
91
+ - "Should this routine always use the API, or sometimes browser?"
92
+ - "Are there apps where [specific step] wouldn't apply?"
93
+
94
+ **Scope questions:**
95
+ - "Should this cover [adjacent step] too, or is that separate?"
96
+ - "Does this workflow change if the app supports SCIM?"
97
+ - "Should I parameterize [specific value] or hardcode it?"
98
+
99
+ **Environment questions:**
100
+ - "Does this only work in the ragnarok repo, or should it be repo-agnostic?"
101
+ - "Are there API access requirements I should document?"
102
+
103
+ ### Step 4: Write the Routine (`~/.ftm/routines/{name}.yml`)
104
+
105
+ Follow the exact YAML format used by ftm-routine:
106
+
107
+ ```yaml
108
+ name: {kebab-case-name}
109
+ description: |
110
+ {What this routine does, when to use it, critical ordering rules}
111
+ trigger: manual
112
+ tags: [{relevant, tags}]
113
+
114
+ # Usage:
115
+ # /ftm-routine {name}
116
+ # or: "{natural language trigger}"
117
+ #
118
+ # Required context:
119
+ # - {param}: {description}
120
+
121
+ phases:
122
+ - name: "Phase N: {Phase Name}"
123
+ steps:
124
+ - name: {Step description}
125
+ action: {api|playwright_cli|python_browser|mcp|skill|routine|comms|manual|wait}
126
+ tool: {tool_name}
127
+ params: {exact parameters}
128
+ notes: |
129
+ {Gotchas, workarounds, known issues}
130
+ approval: {none|review|approve}
131
+
132
+ known_issues:
133
+ - issue: "{Issue name}"
134
+ description: "{What goes wrong}"
135
+ fix: "{How to fix it}"
136
+ ```
137
+
138
+ **Critical rules for routine writing:**
139
+ - Every step must specify the exact tool/action — no vague "do X"
140
+ - Include `notes` on steps that have known gotchas
141
+ - Use `approval: approve` for destructive or externally-visible actions
142
+ - Parameterize with `{curly_braces}` for values that change per invocation
143
+ - Include `known_issues` section with every API/tool gotcha discovered during the session
144
+ - Include environment assumptions (repo, API access, etc.) in the description
145
+
146
+ ### Step 5: Write the Playbook (`~/.claude/eng-buddy/playbooks/{name}.json`)
147
+
148
+ Follow the exact JSON format used by eng-buddy playbooks:
149
+
150
+ ```json
151
+ {
152
+ "id": "{kebab-case-name}",
153
+ "name": "{Human-readable name}",
154
+ "description": "{What and when}",
155
+ "trigger_keywords": ["{keywords}"],
156
+ "input_params": {
157
+ "{param}": {"type": "string", "description": "...", "required": true}
158
+ },
159
+ "steps": [
160
+ {
161
+ "number": 1,
162
+ "description": "{What this step does}",
163
+ "tool": "{exact_tool_name}",
164
+ "tool_params": {"exact": "params"},
165
+ "requires_human": false,
166
+ "notes": "{Gotchas}"
167
+ }
168
+ ],
169
+ "rollback": {
170
+ "description": "{How to undo}",
171
+ "steps": ["{exact}", "{reversal}", "{steps}"]
172
+ },
173
+ "known_issues": [
174
+ {"issue": "{Name}", "description": "...", "fix": "..."}
175
+ ],
176
+ "confidence": 1.0,
177
+ "version": 1,
178
+ "executions": 0,
179
+ "source": "captured",
180
+ "related_links": {}
181
+ }
182
+ ```
183
+
184
+ **Critical rules for playbook writing:**
185
+ - Every step must have exact `tool` and `tool_params` — eng-buddy executes these literally
186
+ - Include `rollback` section with exact reversal steps
187
+ - Set `requires_human: true` for steps needing auth, visual verification, or judgment
188
+ - `source: "captured"` distinguishes from `"manual"` or `"observed"`
189
+
190
+ ### Step 6: Write the Reference Doc (`~/Documents/Code/panda/docs/playbooks/{name}.md`)
191
+
192
+ This is the human-readable + agent-readable reference that captures context, gotchas, and decision rationale:
193
+
194
+ ```markdown
195
+ # {Workflow Name} — {Type} Playbook
196
+
197
+ ## Purpose
198
+ {What this workflow does and when to use it}
199
+
200
+ ## Execution Method
201
+ {Primary: API / Browser / Mixed — and why}
202
+
203
+ ## Prerequisites
204
+ {API access, repo, tools, credentials needed}
205
+
206
+ ## Phases
207
+ ### Phase 1: {Name}
208
+ {Steps with exact tool calls, selectors, API endpoints}
209
+
210
+ ### Phase 2: {Name}
211
+ ...
212
+
213
+ ## Known Issues & Gotchas
214
+ {Every API quirk, UI gotcha, and workaround discovered}
215
+
216
+ ## Decision Points
217
+ {Where the workflow branches and how to decide}
218
+
219
+ ## Information Needed from User
220
+ {What to collect before starting}
221
+ ```
222
+
223
+ ### Step 7: Record Experience
224
+
225
+ Write to `~/.claude/ftm-state/blackboard/experiences/{name}-capture.json`:
226
+
227
+ ```json
228
+ {
229
+ "id": "{name}-capture",
230
+ "timestamp": "{ISO timestamp}",
231
+ "task_type": "knowledge-capture",
232
+ "tags": ["{workflow-type}", "capture", "routine", "playbook"],
233
+ "outcome": "success",
234
+ "description": "Captured {workflow name} as routine + playbook + reference doc",
235
+ "lessons": ["{key learnings encoded}"],
236
+ "files_touched": [
237
+ "~/.ftm/routines/{name}.yml",
238
+ "~/.claude/eng-buddy/playbooks/{name}.json",
239
+ "~/Documents/Code/panda/docs/playbooks/{name}.md"
240
+ ],
241
+ "confidence": 1.0
242
+ }
243
+ ```
244
+
245
+ Update `experiences/index.json` with the new entry.
246
+
247
+ ### Step 8: Update Blackboard Context
248
+
249
+ Update `~/.claude/ftm-state/blackboard/context.json`:
250
+ - Set `current_task.status` to reflect capture completion
251
+ - Add to `recent_decisions`: what was captured and why
252
+
253
+ ### Step 9: Report to User
254
+
255
+ Show a summary:
256
+
257
+ ```
258
+ Captured: {workflow name}
259
+
260
+ Written to:
261
+ Routine: ~/.ftm/routines/{name}.yml
262
+ Playbook: ~/.claude/eng-buddy/playbooks/{name}.json
263
+ Reference: ~/Documents/Code/panda/docs/playbooks/{name}.md
264
+
265
+ Known issues encoded: {count}
266
+ Parameters: {list of parameterized values}
267
+ Phases: {count} phases, {count} steps
268
+
269
+ Next time, run: /ftm-routine {name}
270
+ ```
271
+
272
+ ## Updating Existing Artifacts
273
+
274
+ If Step 1 finds an existing routine/playbook/reference doc:
275
+
276
+ 1. Load the existing version
277
+ 2. Show the user what exists vs what's new
278
+ 3. Ask: "Update existing or create new version?"
279
+ 4. If updating:
280
+ - Merge new steps into existing phases
281
+ - Add new known_issues (don't duplicate)
282
+ - Increment `version` in playbook JSON
283
+ - Add "Updated: {date} — {what changed}" to reference doc
284
+ 5. If creating new:
285
+ - Use a different name (e.g., `sso-full-setup-v2`)
286
+
287
+ ## Integration Points
288
+
289
+ ### ftm-mind
290
+ ftm-mind knows about ftm-capture in its capability inventory. When ftm-mind detects:
291
+ - User completing a repeatable workflow
292
+ - Matching experiences in the blackboard (same task_type done 2+ times)
293
+ - User saying anything about "remembering" or "next time"
294
+
295
+ It should suggest: "This looks like a reusable pattern. Want me to `/ftm capture` it?"
296
+
297
+ ### ftm-retro
298
+ After ftm-retro scores an execution, if the workflow is repeatable, it should note: "Consider running `/ftm capture {name}` to save this as a routine."
299
+
300
+ ### ftm-routine
301
+ ftm-routine reads from `~/.ftm/routines/`. Anything ftm-capture writes there becomes immediately available via `/ftm-routine {name}`.
302
+
303
+ ### eng-buddy
304
+ eng-buddy's playbook engine reads from `~/.claude/eng-buddy/playbooks/`. Captured playbooks show up on the dashboard's Playbooks tab.
305
+
306
+ ### Environment Awareness
307
+
308
+ When capturing, always note the environment context:
309
+ - **If in `~/Documents/Code/ragnarok`**: Full API access to Okta, Freshservice, Slack, AWS (via shared_services). Prefer API over browser.
310
+ - **If in other repos**: May not have API access. Default to browser automation or MCP tools.
311
+ - **Always document**: Which APIs are used, what credentials are needed, what repo provides the client libraries.
312
+
313
+ This prevents future sessions from trying to use APIs they don't have access to.
314
+
315
+ ## Requirements
316
+
317
+ - reference: `~/.claude/ftm-state/blackboard/context.json` | required | current task and recent decisions for pattern extraction
318
+ - reference: `~/.claude/eng-buddy/daily/{today}.md` | optional | daily log for completed items and tool calls
319
+ - reference: `~/.claude/ftm-state/blackboard/experiences/index.json` | required | today's session experiences
320
+ - reference: `~/.ftm/routines/` | optional | check for existing routines before creating new one
321
+ - reference: `~/.claude/eng-buddy/playbooks/` | optional | check for existing playbooks before creating
322
+ - reference: `~/Documents/Code/panda/docs/playbooks/` | optional | check for existing reference docs before creating
323
+
324
+ ## Risk
325
+
326
+ - level: low_write
327
+ - scope: writes YAML routine to ~/.ftm/routines/, JSON playbook to ~/.claude/eng-buddy/playbooks/, and Markdown reference doc to ~/Documents/Code/panda/docs/playbooks/; writes experience to blackboard; does not modify project source code
328
+ - rollback: delete the three written artifact files; remove experience entry from blackboard experiences/
329
+
330
+ ## Approval Gates
331
+
332
+ - trigger: existing artifact found for this workflow name | action: show existing vs new content, ask user to confirm update or create new version
333
+ - trigger: Step 3 clarifying questions answered | action: proceed to write all three artifacts automatically (no additional gate)
334
+ - complexity_routing: micro → auto | small → auto | medium → auto | large → auto | xl → auto
335
+
336
+ ## Fallbacks
337
+
338
+ - condition: blackboard context.json missing | action: ask user directly about the workflow to capture instead of reading from blackboard
339
+ - condition: daily log missing or empty | action: skip daily log extraction, rely on conversation context and blackboard experiences
340
+ - condition: ~/.ftm/routines/ directory doesn't exist | action: create directory before writing routine
341
+ - condition: docs/playbooks/ directory doesn't exist | action: create directory before writing reference doc
342
+ - condition: existing artifact found but cannot be parsed | action: treat as missing, create fresh artifact
343
+
344
+ ## Capabilities
345
+
346
+ - mcp: none required directly (reads files and writes artifacts)
347
+ - env: none required
348
+
349
+ ## Event Payloads
350
+
351
+ ### capture_complete
352
+ - skill: string — "ftm-capture"
353
+ - workflow_name: string — kebab-case name of captured workflow
354
+ - routine_path: string — absolute path to written routine YAML
355
+ - playbook_path: string — absolute path to written playbook JSON
356
+ - reference_path: string — absolute path to written reference doc
357
+ - phases_count: number — number of workflow phases captured
358
+ - steps_count: number — total steps across all phases
359
+ - known_issues_count: number — API gotchas encoded
360
+
361
+ ### experience_recorded
362
+ - skill: string — "ftm-capture"
363
+ - experience_path: string — path to written experience file
364
+ - workflow_name: string — name of captured workflow
365
+
366
+ ### known_issue_recorded
367
+ - skill: string — "ftm-capture"
368
+ - workflow_name: string — workflow this issue belongs to
369
+ - issue: string — issue name
370
+ - fix: string — remediation approach encoded
@@ -0,0 +1,4 @@
1
+ ---
2
+ name: ftm-capture
3
+ description: Extract reusable routines, playbooks, and reference docs from the current session's work. Reads session context (blackboard, daily log, tool history), asks clarifying questions about generalizability, then writes to all three ftm knowledge layers (~/.ftm/routines/, ~/.claude/eng-buddy/playbooks/, ~/Documents/Code/panda/docs/playbooks/). Use when user says "capture this", "save this as a routine", "make a playbook from this", "ftm capture", "codify this", "turn this into a routine", "extract the pattern", "save what we did", or after completing a repeatable workflow that should be reusable. Also triggers on "learn from this", "remember how to do this", "don't make me explain this again".
4
+ ---
@@ -300,3 +300,62 @@ When returning an error before Codex runs:
300
300
  ### Remaining Issues
301
301
  - [error detail]
302
302
  ```
303
+
304
+ ## Requirements
305
+
306
+ - tool: `codex` | required | OpenAI Codex CLI for adversarial validation
307
+ - reference: `{project_root}/INTENT.md` | optional | root intent documentation for conflict detection
308
+ - reference: `{project_root}/STYLE.md` | optional | code style standards for quality enforcement
309
+ - reference: module-level `INTENT.md` files | optional | per-module intent for targeted conflict detection
310
+ - reference: `~/.claude/ftm-state/blackboard/context.json` | optional | session state
311
+ - reference: `~/.claude/ftm-state/blackboard/experiences/index.json` | optional | prior validation patterns
312
+
313
+ ## Risk
314
+
315
+ - level: medium_write
316
+ - scope: Codex modifies source files and commits fixes directly in the project working directory (--yolo mode); writes entries to DEBUG.md; writes structured output to /tmp/codex-result-*.md
317
+ - rollback: git revert codex fix commits; delete /tmp/codex-result-*.md cleanup is automatic
318
+
319
+ ## Approval Gates
320
+
321
+ - trigger: codex gate returns PASS_WITH_FIXES and INTENT.md conflict detected | action: auto-invoke ftm-council for arbitration before accepting or reverting the fix
322
+ - trigger: codex gate returns FAIL after 2 fix attempts | action: report remaining issues to ftm-executor caller, wait for direction
323
+ - trigger: codex CLI not found | action: return FAIL immediately with install instructions, do not proceed
324
+ - complexity_routing: micro → auto | small → auto | medium → auto | large → auto | xl → auto
325
+
326
+ ## Fallbacks
327
+
328
+ - condition: codex CLI not installed | action: return FAIL with "Codex CLI not found. Install with: npm install -g @openai/codex"
329
+ - condition: codex times out after 600s | action: read partial output if available, return PARTIAL results with note; if no output, return FAIL
330
+ - condition: output file empty or missing | action: return FAIL with "Codex output not found — may have crashed"
331
+ - condition: INTENT.md missing at project root | action: note in prompt to Codex and continue without INTENT validation
332
+ - condition: STYLE.md missing | action: note in prompt to Codex and continue without style enforcement
333
+
334
+ ## Capabilities
335
+
336
+ - cli: `codex` | required | OpenAI Codex CLI (npm install -g @openai/codex)
337
+ - env: `OPENAI_API_KEY` | required | authentication for Codex CLI execution
338
+
339
+ ## Event Payloads
340
+
341
+ ### review_complete
342
+ - skill: string — "ftm-codex-gate"
343
+ - mode: string — "wave" | "single-task"
344
+ - status: string — "PASS" | "PASS_WITH_FIXES" | "FAIL"
345
+ - tests_formed: number — adversarial test scenarios generated
346
+ - tests_passed: number — test scenarios that passed
347
+ - fixes_applied: number — fixes committed by Codex
348
+ - quality_issues: number — style/quality violations found
349
+ - intent_conflicts: number — INTENT.md conflicts detected
350
+
351
+ ### issue_found
352
+ - skill: string — "ftm-codex-gate"
353
+ - file_path: string — file where issue was found
354
+ - line: number | null — line number if available
355
+ - description: string — issue description
356
+ - type: string — "test_failure" | "quality_violation" | "intent_conflict"
357
+
358
+ ### task_completed
359
+ - skill: string — "ftm-codex-gate"
360
+ - status: string — "PASS" | "PASS_WITH_FIXES" | "FAIL"
361
+ - output_file: string — path to Codex result file
@@ -308,3 +308,38 @@ If the YAML cannot be parsed, the skill will back up the broken file as `~/.clau
308
308
 
309
309
  ### Changes not taking effect
310
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.
311
+
312
+ ## Requirements
313
+
314
+ - config: `~/.claude/ftm-config.yml` | optional | main config file (created with defaults if missing)
315
+
316
+ ## Risk
317
+
318
+ - level: low_write
319
+ - scope: reads and writes ~/.claude/ftm-config.yml only; backs up malformed config to ftm-config.yml.bak before overwriting; no project files touched
320
+ - rollback: restore from ~/.claude/ftm-config.yml.bak or delete the file to reset to defaults on next invocation
321
+
322
+ ## Approval Gates
323
+
324
+ - trigger: reset command issued | action: show current config and ask "Proceed?" before restoring defaults
325
+ - trigger: invalid model name or profile name provided | action: reject with clear error showing valid options, do not write
326
+ - complexity_routing: micro → auto | small → auto | medium → auto | large → auto | xl → auto
327
+
328
+ ## Fallbacks
329
+
330
+ - condition: ftm-config.yml missing | action: create file with default balanced profile and all defaults
331
+ - condition: ftm-config.yml malformed YAML | action: back up as ftm-config.yml.bak, create fresh default config
332
+ - condition: invalid model or profile value provided | action: reject and show valid options without writing
333
+
334
+ ## Capabilities
335
+
336
+ - env: none required
337
+
338
+ ## Event Payloads
339
+
340
+ ### task_completed
341
+ - skill: string — "ftm-config"
342
+ - action: string — "display" | "set_profile" | "set_value" | "reset" | "show_profiles" | "show_skills"
343
+ - changed_key: string | null — dotted path of changed setting
344
+ - old_value: string | null — value before change
345
+ - new_value: string | null — value after change
@@ -130,3 +130,59 @@ After completing, update the blackboard:
130
130
  2. Write an experience file to `~/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json` capturing decision domain, verdict, round reached, dissent summary, and whether the verdict held up
131
131
  3. Update `~/.claude/ftm-state/blackboard/experiences/index.json` with the new entry
132
132
  4. Emit `task_completed` event
133
+
134
+ ## Requirements
135
+
136
+ - tool: `codex` | required | Codex CLI for independent peer investigation
137
+ - tool: `gemini` | required | Gemini CLI for independent peer investigation
138
+ - reference: `references/protocols/PREREQUISITES.md` | required | availability check, fallback logic, timeout config
139
+ - reference: `references/protocols/STEP-0-FRAMING.md` | required | problem framing format
140
+ - reference: `references/prompts/CLAUDE-INVESTIGATION.md` | required | Claude investigation prompt template
141
+ - reference: `references/prompts/CODEX-INVESTIGATION.md` | required | Codex investigation prompt template
142
+ - reference: `references/prompts/GEMINI-INVESTIGATION.md` | required | Gemini investigation prompt template
143
+ - reference: `references/prompts/REBUTTAL-TEMPLATE.md` | required | rebuttal round prompt template
144
+ - reference: `~/.claude/ftm-state/blackboard/context.json` | optional | session state
145
+
146
+ ## Risk
147
+
148
+ - level: read_only
149
+ - scope: reads codebase for independent investigation; does not modify source files; writes blackboard experience after verdict
150
+ - rollback: no source mutations; blackboard write can be reverted by editing JSON files
151
+
152
+ ## Approval Gates
153
+
154
+ - trigger: council prompt framed in Step 0 | action: show framed prompt to user and wait for confirmation before dispatching to council
155
+ - trigger: 2-of-3 majority reached | action: present verdict summary to user and ask if they want to proceed or dig into dissent
156
+ - trigger: auto-invocation by ftm-executor (INTENT.md conflict) | action: skip user framing confirmation, run immediately and return structured COUNCIL VERDICT to caller
157
+ - complexity_routing: micro → auto | small → auto | medium → auto | large → auto | xl → auto
158
+
159
+ ## Fallbacks
160
+
161
+ - condition: codex CLI not found | action: report missing dependency with install instructions and stop (do not run degraded council)
162
+ - condition: gemini CLI not found | action: report missing dependency with install instructions and stop
163
+ - condition: no majority after 5 rounds | action: synthesize final positions, highlight core tension, present 2-3 concrete options for user decision
164
+ - condition: model times out during a round | action: note timeout for that model, continue round with remaining models' responses
165
+
166
+ ## Capabilities
167
+
168
+ - cli: `codex` | required | OpenAI Codex CLI peer reviewer
169
+ - cli: `gemini` | required | Google Gemini CLI peer reviewer
170
+ - env: `OPENAI_API_KEY` | required | for Codex CLI authentication
171
+ - env: `GEMINI_API_KEY` | required | for Gemini CLI authentication
172
+
173
+ ## Event Payloads
174
+
175
+ ### review_complete
176
+ - skill: string — "ftm-council"
177
+ - verdict: string — "update_intent" | "revert_fix" | "option_a" | "option_b" | custom decision
178
+ - round: number — round in which majority was reached (1-5, or 5+ for synthesis)
179
+ - agreed_by: string[] — which models agreed on the verdict
180
+ - dissent: string | null — summary of dissenting position
181
+ - reasoning: string — why the majority won
182
+
183
+ ### task_completed
184
+ - skill: string — "ftm-council"
185
+ - decision_domain: string — topic the council deliberated on
186
+ - verdict: string — final decision
187
+ - round: number — rounds taken to reach verdict
188
+ - duration_ms: number — total deliberation time