feed-the-machine 1.6.1 → 1.7.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 (269) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +170 -170
  3. package/bin/brain.py +1340 -0
  4. package/bin/convert_claude_skills_to_codex.py +490 -0
  5. package/bin/generate-manifest.mjs +463 -463
  6. package/bin/harden_codex_skills.py +141 -0
  7. package/bin/install.mjs +491 -491
  8. package/bin/migrate-eng-buddy-data.py +875 -0
  9. package/bin/playbook_engine/__init__.py +1 -0
  10. package/bin/playbook_engine/conftest.py +8 -0
  11. package/bin/playbook_engine/extractor.py +33 -0
  12. package/bin/playbook_engine/manager.py +102 -0
  13. package/bin/playbook_engine/models.py +84 -0
  14. package/bin/playbook_engine/registry.py +35 -0
  15. package/bin/playbook_engine/test_extractor.py +72 -0
  16. package/bin/playbook_engine/test_integration.py +129 -0
  17. package/bin/playbook_engine/test_manager.py +85 -0
  18. package/bin/playbook_engine/test_models.py +166 -0
  19. package/bin/playbook_engine/test_registry.py +67 -0
  20. package/bin/playbook_engine/test_tracer.py +86 -0
  21. package/bin/playbook_engine/tracer.py +93 -0
  22. package/bin/tasks_db.py +456 -0
  23. package/docs/HOOKS.md +243 -243
  24. package/docs/INBOX.md +233 -233
  25. package/ftm/SKILL.md +125 -122
  26. package/ftm-audit/SKILL.md +623 -623
  27. package/ftm-audit/references/protocols/PROJECT-PATTERNS.md +91 -91
  28. package/ftm-audit/references/protocols/RUNTIME-WIRING.md +66 -66
  29. package/ftm-audit/references/protocols/WIRING-CONTRACTS.md +135 -135
  30. package/ftm-audit/references/strategies/AUTO-FIX-STRATEGIES.md +69 -69
  31. package/ftm-audit/references/templates/REPORT-FORMAT.md +96 -96
  32. package/ftm-audit/scripts/run-knip.sh +23 -23
  33. package/ftm-audit.yml +2 -2
  34. package/ftm-brainstorm/SKILL.md +1003 -498
  35. package/ftm-brainstorm/evals/evals.json +180 -100
  36. package/ftm-brainstorm/evals/promptfoo.yaml +109 -109
  37. package/ftm-brainstorm/references/agent-prompts.md +552 -224
  38. package/ftm-brainstorm/references/plan-template.md +209 -121
  39. package/ftm-brainstorm.yml +2 -2
  40. package/ftm-browse/SKILL.md +454 -454
  41. package/ftm-browse/daemon/browser-manager.ts +206 -206
  42. package/ftm-browse/daemon/bun.lock +30 -30
  43. package/ftm-browse/daemon/cli.ts +347 -347
  44. package/ftm-browse/daemon/commands.ts +410 -410
  45. package/ftm-browse/daemon/main.ts +357 -357
  46. package/ftm-browse/daemon/package.json +17 -17
  47. package/ftm-browse/daemon/server.ts +189 -189
  48. package/ftm-browse/daemon/snapshot.ts +519 -519
  49. package/ftm-browse/daemon/tsconfig.json +22 -22
  50. package/ftm-browse.yml +4 -4
  51. package/ftm-capture/SKILL.md +370 -370
  52. package/ftm-capture.yml +4 -4
  53. package/ftm-codex-gate/SKILL.md +361 -361
  54. package/ftm-codex-gate.yml +2 -2
  55. package/ftm-config/SKILL.md +422 -345
  56. package/ftm-config.default.yml +125 -82
  57. package/ftm-config.yml +44 -2
  58. package/ftm-council/SKILL.md +416 -416
  59. package/ftm-council/references/prompts/CLAUDE-INVESTIGATION.md +60 -60
  60. package/ftm-council/references/prompts/CODEX-INVESTIGATION.md +58 -58
  61. package/ftm-council/references/prompts/GEMINI-INVESTIGATION.md +58 -58
  62. package/ftm-council/references/prompts/REBUTTAL-TEMPLATE.md +57 -57
  63. package/ftm-council/references/protocols/PREREQUISITES.md +47 -47
  64. package/ftm-council/references/protocols/STEP-0-FRAMING.md +46 -46
  65. package/ftm-council.yml +2 -2
  66. package/ftm-dashboard/SKILL.md +163 -163
  67. package/ftm-dashboard.yml +4 -4
  68. package/ftm-debug/SKILL.md +1037 -1037
  69. package/ftm-debug/references/phases/PHASE-0-INTAKE.md +58 -58
  70. package/ftm-debug/references/phases/PHASE-1-TRIAGE.md +46 -46
  71. package/ftm-debug/references/phases/PHASE-2-WAR-ROOM-AGENTS.md +279 -279
  72. package/ftm-debug/references/phases/PHASE-3-TO-6-EXECUTION.md +436 -436
  73. package/ftm-debug/references/protocols/BLACKBOARD.md +86 -86
  74. package/ftm-debug/references/protocols/EDGE-CASES.md +103 -103
  75. package/ftm-debug.yml +2 -2
  76. package/ftm-diagram/SKILL.md +277 -277
  77. package/ftm-diagram.yml +2 -2
  78. package/ftm-executor/SKILL.md +777 -777
  79. package/ftm-executor/references/STYLE-TEMPLATE.md +73 -73
  80. package/ftm-executor/references/phases/PHASE-0-VERIFICATION.md +62 -62
  81. package/ftm-executor/references/phases/PHASE-2-AGENT-ASSEMBLY.md +34 -34
  82. package/ftm-executor/references/phases/PHASE-3-WORKTREES.md +38 -38
  83. package/ftm-executor/references/phases/PHASE-4-5-AUDIT.md +72 -72
  84. package/ftm-executor/references/phases/PHASE-4-DISPATCH.md +66 -66
  85. package/ftm-executor/references/phases/PHASE-5-5-CODEX-GATE.md +73 -73
  86. package/ftm-executor/references/protocols/DOCUMENTATION-BOOTSTRAP.md +36 -36
  87. package/ftm-executor/references/protocols/MODEL-PROFILE.md +59 -59
  88. package/ftm-executor/references/protocols/PROGRESS-TRACKING.md +66 -66
  89. package/ftm-executor/runtime/ftm-runtime.mjs +252 -252
  90. package/ftm-executor/runtime/package.json +8 -8
  91. package/ftm-executor.yml +2 -2
  92. package/ftm-git/SKILL.md +441 -441
  93. package/ftm-git/evals/evals.json +26 -26
  94. package/ftm-git/evals/promptfoo.yaml +75 -75
  95. package/ftm-git/hooks/post-commit-experience.sh +92 -92
  96. package/ftm-git/references/patterns/SECRET-PATTERNS.md +104 -104
  97. package/ftm-git/references/protocols/REMEDIATION.md +139 -139
  98. package/ftm-git/scripts/pre-commit-secrets.sh +110 -110
  99. package/ftm-git.yml +2 -2
  100. package/ftm-inbox/backend/__pycache__/main.cpython-314.pyc +0 -0
  101. package/ftm-inbox/backend/adapters/_retry.py +64 -64
  102. package/ftm-inbox/backend/adapters/base.py +230 -230
  103. package/ftm-inbox/backend/adapters/freshservice.py +104 -104
  104. package/ftm-inbox/backend/adapters/gmail.py +125 -125
  105. package/ftm-inbox/backend/adapters/jira.py +136 -136
  106. package/ftm-inbox/backend/adapters/registry.py +192 -192
  107. package/ftm-inbox/backend/adapters/slack.py +110 -110
  108. package/ftm-inbox/backend/db/connection.py +54 -54
  109. package/ftm-inbox/backend/db/schema.py +78 -78
  110. package/ftm-inbox/backend/executor/__init__.py +7 -7
  111. package/ftm-inbox/backend/executor/engine.py +149 -149
  112. package/ftm-inbox/backend/executor/step_runner.py +98 -98
  113. package/ftm-inbox/backend/main.py +103 -103
  114. package/ftm-inbox/backend/models/__init__.py +1 -1
  115. package/ftm-inbox/backend/models/unified_task.py +36 -36
  116. package/ftm-inbox/backend/planner/__init__.py +6 -6
  117. package/ftm-inbox/backend/planner/__pycache__/__init__.cpython-314.pyc +0 -0
  118. package/ftm-inbox/backend/planner/__pycache__/generator.cpython-314.pyc +0 -0
  119. package/ftm-inbox/backend/planner/__pycache__/schema.cpython-314.pyc +0 -0
  120. package/ftm-inbox/backend/planner/generator.py +127 -127
  121. package/ftm-inbox/backend/planner/schema.py +34 -34
  122. package/ftm-inbox/backend/requirements.txt +5 -5
  123. package/ftm-inbox/backend/routes/__pycache__/plan.cpython-314.pyc +0 -0
  124. package/ftm-inbox/backend/routes/execute.py +186 -186
  125. package/ftm-inbox/backend/routes/health.py +52 -52
  126. package/ftm-inbox/backend/routes/inbox.py +68 -68
  127. package/ftm-inbox/backend/routes/plan.py +271 -271
  128. package/ftm-inbox/bin/launchagent.mjs +91 -91
  129. package/ftm-inbox/bin/setup.mjs +188 -188
  130. package/ftm-inbox/bin/start.sh +10 -10
  131. package/ftm-inbox/bin/status.sh +17 -17
  132. package/ftm-inbox/bin/stop.sh +8 -8
  133. package/ftm-inbox/config.example.yml +55 -55
  134. package/ftm-inbox/package-lock.json +2898 -2898
  135. package/ftm-inbox/package.json +26 -26
  136. package/ftm-inbox/postcss.config.js +6 -6
  137. package/ftm-inbox/src/app.css +199 -199
  138. package/ftm-inbox/src/app.html +18 -18
  139. package/ftm-inbox/src/lib/api.ts +166 -166
  140. package/ftm-inbox/src/lib/components/ExecutionLog.svelte +81 -81
  141. package/ftm-inbox/src/lib/components/InboxFeed.svelte +143 -143
  142. package/ftm-inbox/src/lib/components/PlanStep.svelte +271 -271
  143. package/ftm-inbox/src/lib/components/PlanView.svelte +206 -206
  144. package/ftm-inbox/src/lib/components/StreamPanel.svelte +99 -99
  145. package/ftm-inbox/src/lib/components/TaskCard.svelte +190 -190
  146. package/ftm-inbox/src/lib/components/ui/EmptyState.svelte +63 -63
  147. package/ftm-inbox/src/lib/components/ui/KawaiiCard.svelte +86 -86
  148. package/ftm-inbox/src/lib/components/ui/PillButton.svelte +106 -106
  149. package/ftm-inbox/src/lib/components/ui/StatusBadge.svelte +67 -67
  150. package/ftm-inbox/src/lib/components/ui/StreamDrawer.svelte +149 -149
  151. package/ftm-inbox/src/lib/components/ui/ThemeToggle.svelte +80 -80
  152. package/ftm-inbox/src/lib/theme.ts +47 -47
  153. package/ftm-inbox/src/routes/+layout.svelte +76 -76
  154. package/ftm-inbox/src/routes/+page.svelte +401 -401
  155. package/ftm-inbox/svelte.config.js +12 -12
  156. package/ftm-inbox/tailwind.config.ts +63 -63
  157. package/ftm-inbox/tsconfig.json +13 -13
  158. package/ftm-inbox/vite.config.ts +6 -6
  159. package/ftm-intent/SKILL.md +241 -241
  160. package/ftm-intent.yml +2 -2
  161. package/ftm-manifest.json +3794 -3794
  162. package/ftm-map/SKILL.md +291 -291
  163. package/ftm-map/scripts/db.py +712 -712
  164. package/ftm-map/scripts/index.py +415 -415
  165. package/ftm-map/scripts/parser.py +224 -224
  166. package/ftm-map/scripts/queries/go-tags.scm +20 -20
  167. package/ftm-map/scripts/queries/javascript-tags.scm +35 -35
  168. package/ftm-map/scripts/queries/python-tags.scm +31 -31
  169. package/ftm-map/scripts/queries/ruby-tags.scm +19 -19
  170. package/ftm-map/scripts/queries/rust-tags.scm +37 -37
  171. package/ftm-map/scripts/queries/typescript-tags.scm +41 -41
  172. package/ftm-map/scripts/query.py +301 -301
  173. package/ftm-map/scripts/ranker.py +377 -377
  174. package/ftm-map/scripts/requirements.txt +5 -5
  175. package/ftm-map/scripts/setup-hooks.sh +27 -27
  176. package/ftm-map/scripts/setup.sh +56 -56
  177. package/ftm-map/scripts/test_db.py +364 -364
  178. package/ftm-map/scripts/test_parser.py +174 -174
  179. package/ftm-map/scripts/test_query.py +183 -183
  180. package/ftm-map/scripts/test_ranker.py +199 -199
  181. package/ftm-map/scripts/views.py +591 -591
  182. package/ftm-map.yml +2 -2
  183. package/ftm-mind/SKILL.md +201 -1943
  184. package/ftm-mind/evals/promptfoo.yaml +142 -142
  185. package/ftm-mind/references/blackboard-protocol.md +110 -0
  186. package/ftm-mind/references/blackboard-schema.md +328 -328
  187. package/ftm-mind/references/complexity-guide.md +110 -110
  188. package/ftm-mind/references/complexity-sizing.md +138 -0
  189. package/ftm-mind/references/decide-act-protocol.md +172 -0
  190. package/ftm-mind/references/direct-execution.md +51 -0
  191. package/ftm-mind/references/environment-discovery.md +77 -0
  192. package/ftm-mind/references/event-registry.md +319 -319
  193. package/ftm-mind/references/mcp-inventory.md +300 -296
  194. package/ftm-mind/references/ops-routing.md +47 -0
  195. package/ftm-mind/references/orient-protocol.md +234 -0
  196. package/ftm-mind/references/personality.md +40 -0
  197. package/ftm-mind/references/protocols/COMPLEXITY-SIZING.md +72 -72
  198. package/ftm-mind/references/protocols/MCP-HEURISTICS.md +32 -32
  199. package/ftm-mind/references/protocols/PLAN-APPROVAL.md +80 -80
  200. package/ftm-mind/references/reflexion-protocol.md +249 -249
  201. package/ftm-mind/references/routing/SCENARIOS.md +22 -22
  202. package/ftm-mind/references/routing-scenarios.md +35 -35
  203. package/ftm-mind.yml +2 -2
  204. package/ftm-ops.yml +4 -0
  205. package/ftm-pause/SKILL.md +395 -395
  206. package/ftm-pause/references/protocols/SKILL-RESTORE-PROTOCOLS.md +186 -186
  207. package/ftm-pause/references/protocols/VALIDATION.md +80 -80
  208. package/ftm-pause.yml +2 -2
  209. package/ftm-researcher/SKILL.md +275 -275
  210. package/ftm-researcher/evals/agent-diversity.yaml +17 -17
  211. package/ftm-researcher/evals/synthesis-quality.yaml +12 -12
  212. package/ftm-researcher/evals/trigger-accuracy.yaml +39 -39
  213. package/ftm-researcher/references/adaptive-search.md +116 -116
  214. package/ftm-researcher/references/agent-prompts.md +193 -193
  215. package/ftm-researcher/references/council-integration.md +193 -193
  216. package/ftm-researcher/references/output-format.md +203 -203
  217. package/ftm-researcher/references/synthesis-pipeline.md +165 -165
  218. package/ftm-researcher/scripts/score_credibility.py +234 -234
  219. package/ftm-researcher/scripts/validate_research.py +92 -92
  220. package/ftm-researcher.yml +2 -2
  221. package/ftm-resume/SKILL.md +518 -518
  222. package/ftm-resume/references/protocols/VALIDATION.md +172 -172
  223. package/ftm-resume.yml +2 -2
  224. package/ftm-retro/SKILL.md +380 -380
  225. package/ftm-retro/references/protocols/SCORING-RUBRICS.md +89 -89
  226. package/ftm-retro/references/templates/REPORT-FORMAT.md +109 -109
  227. package/ftm-retro.yml +2 -2
  228. package/ftm-routine/SKILL.md +170 -170
  229. package/ftm-routine.yml +4 -4
  230. package/ftm-state/blackboard/capabilities.json +5 -5
  231. package/ftm-state/blackboard/capabilities.schema.json +27 -27
  232. package/ftm-state/blackboard/context.json +37 -23
  233. package/ftm-state/blackboard/experiences/doom-statusline-fix.json +26 -0
  234. package/ftm-state/blackboard/experiences/hackathon-pages-site.json +26 -0
  235. package/ftm-state/blackboard/experiences/hindsight-sso-kickoff.json +42 -0
  236. package/ftm-state/blackboard/experiences/index.json +58 -9
  237. package/ftm-state/blackboard/experiences/learning-ragnarok-api-access.json +23 -0
  238. package/ftm-state/blackboard/experiences/nordlayer-members-auto-assign.json +26 -0
  239. package/ftm-state/blackboard/experiences/saml2aws-stale-session-fix.json +41 -0
  240. package/ftm-state/blackboard/patterns.json +6 -6
  241. package/ftm-state/schemas/context.schema.json +130 -130
  242. package/ftm-state/schemas/experience-index.schema.json +77 -77
  243. package/ftm-state/schemas/experience.schema.json +78 -78
  244. package/ftm-state/schemas/patterns.schema.json +44 -44
  245. package/ftm-upgrade/SKILL.md +194 -194
  246. package/ftm-upgrade/scripts/check-version.sh +76 -76
  247. package/ftm-upgrade/scripts/upgrade.sh +143 -143
  248. package/ftm-upgrade.yml +2 -2
  249. package/ftm-verify.yml +2 -2
  250. package/ftm.yml +2 -2
  251. package/hooks/ftm-auto-log.sh +137 -0
  252. package/hooks/ftm-blackboard-enforcer.sh +93 -93
  253. package/hooks/ftm-discovery-reminder.sh +90 -90
  254. package/hooks/ftm-drafts-gate.sh +61 -61
  255. package/hooks/ftm-event-logger.mjs +107 -107
  256. package/hooks/ftm-install-hooks.sh +240 -0
  257. package/hooks/ftm-learning-capture.sh +117 -0
  258. package/hooks/ftm-map-autodetect.sh +79 -79
  259. package/hooks/ftm-pending-sync-check.sh +22 -22
  260. package/hooks/ftm-plan-gate.sh +92 -92
  261. package/hooks/ftm-post-commit-trigger.sh +57 -57
  262. package/hooks/ftm-post-compaction.sh +138 -0
  263. package/hooks/ftm-pre-compaction.sh +147 -0
  264. package/hooks/ftm-session-end.sh +52 -0
  265. package/hooks/ftm-session-snapshot.sh +213 -0
  266. package/hooks/settings-template.json +81 -81
  267. package/install.sh +363 -363
  268. package/package.json +84 -84
  269. package/uninstall.sh +25 -25
@@ -1,370 +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
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 ftm-ops 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/ftm-ops/playbooks/{name}.json` | JSON with exact tool params | ftm-ops 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/ftm-ops/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/ftm-ops/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/ftm-ops/playbooks/{name}.json`)
147
+
148
+ Follow the exact JSON format used by ftm-ops 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` — ftm-ops 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/ftm-ops/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/ftm-ops/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
+ ### ftm-ops
304
+ ftm-ops's playbook engine reads from `~/.claude/ftm-ops/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/ftm-ops/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/ftm-ops/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/ftm-ops/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