feed-the-machine 1.6.0 → 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
package/ftm-mind/SKILL.md CHANGED
@@ -1,1943 +1,201 @@
1
- ---
2
- name: ftm-mind
3
- description: Unified OODA cognitive loop for the ftm system. Use for freeform `/ftm` or `/ftm-mind` requests, vague asks, mixed-tool workflows, Jira/ticket-driven work, or any request that should be understood before routing. Also handles explicit ftm skill invocations by honoring the requested skill while still doing a fast orientation pass for context, prerequisites, and approval gates. Triggers on open-ended requests like "help me think through this", bug reports, plan execution asks, Jira URLs, "make this better", mixed MCP asks like "check my calendar and draft a Slack message", and direct skill invocations like "/ftm-debug ..." or "/ftm-brainstorm ...". Do NOT use only when another ftm skill is already actively handling the task and no re-orientation is needed.
4
- ---
5
-
6
- # FTM Mind
7
-
8
- `ftm-mind` is the reasoning core of the ftm ecosystem. It does not route by keyword alone. It observes the request, orients against live state and accumulated memory, decides the smallest correct next move, acts, then loops.
9
-
10
- The loop is:
11
-
12
- `Observe -> Orient -> Decide -> Act -> Observe`
13
-
14
- Most requests finish in one pass. Harder requests loop several times.
15
-
16
- ## Entry Modes
17
-
18
- ### Mode 1: Freeform
19
-
20
- The user says `/ftm ...`, `/ftm-mind ...`, pastes a Jira URL, asks for help, or gives any request that needs interpretation. Run the full loop.
21
-
22
- ### Mode 2: Explicit skill invocation
23
-
24
- The user says `/ftm-debug ...`, `/ftm-brainstorm ...`, `/ftm-audit`, or otherwise clearly names a ftm skill.
25
-
26
- When this happens:
27
-
28
- 1. Respect the explicit choice as the default route.
29
- 2. Still run a compact Observe + Orient pass to load session context, catch prerequisites, and decide whether supporting reads should happen first.
30
- 3. Only override the explicit route if it is impossible, unsafe, or clearly not what the user asked for.
31
-
32
- Examples:
33
-
34
- - `/ftm-debug flaky auth test` -> route to `ftm-debug`
35
- - `/ftm-brainstorm auth design` -> route to `ftm-brainstorm`
36
- - `/ftm-executor ~/.claude/plans/foo.md` -> route to `ftm-executor`
37
- - `/ftm-debug send a Slack message` -> ask whether they meant debug or Slack workflow, because the explicit route conflicts with the literal request
38
-
39
- ## Observe
40
-
41
- Observe is fast and literal. Do not solve yet. Just collect the raw state.
42
-
43
- ### 1. Capture the request exactly
44
-
45
- Preserve:
46
-
47
- - the full user text
48
- - any explicit skill names
49
- - file paths, URLs, ticket IDs, issue keys, error messages, stack traces, branch names
50
- - any time signal such as "today", "after lunch", "before deploy"
51
- - whether the user sounds blocked, exploratory, urgent, or already mid-flight
52
-
53
- ### 2. Detect the task shape
54
-
55
- At Observe time, note but do not finalize:
56
-
57
- - likely task type: `feature`, `bug`, `refactor`, `investigation`, `configuration`, `documentation`, `test`, `deploy`, `communication`, `research`, `multi`
58
- - likely scope: answer, edit, workflow, orchestration
59
- - whether this looks like a continuation of the current session or a fresh branch of work
60
-
61
- ### 3. Load active session state
62
-
63
- Read:
64
-
65
- - `~/.claude/ftm-state/blackboard/context.json`
66
-
67
- Extract:
68
-
69
- - `current_task`
70
- - `recent_decisions`
71
- - `active_constraints`
72
- - `user_preferences`
73
- - `session_metadata.skills_invoked`
74
-
75
- If the file is missing, empty, or malformed, treat it as empty state and continue normally.
76
-
77
- ### 4. Snapshot codebase reality
78
-
79
- Check local codebase state before interpreting implementation requests:
80
-
81
- - `git status --short`
82
- - `git log --oneline -5`
83
-
84
- Note:
85
-
86
- - uncommitted changes
87
- - recent commits
88
- - current branch
89
- - whether the worktree is clean or mid-change
90
-
91
- Do not infer meaning yet. Just collect.
92
-
93
- ## Orient
94
-
95
- Orient is the crown jewel. Spend most of the reasoning budget here. The job is not to fill a checklist. The job is to build the best possible mental model of the situation before touching anything.
96
-
97
- Orient answers:
98
-
99
- `What is actually going on, what matters most, what is the smallest correct move, and what capability mix fits this situation?`
100
-
101
- ### Orient Priority Order
102
-
103
- When signals conflict, trust them in this order:
104
-
105
- 1. User intent and explicit instructions
106
- 2. Live codebase and tool state
107
- 3. Session trajectory and recent decisions
108
- 4. Relevant past experiences
109
- 5. Promoted patterns
110
- 6. Default heuristics
111
-
112
- Experience and patterns are accelerators, not authorities. They should never override direct evidence from the present task.
113
-
114
- ### 1. Request Geometry
115
-
116
- Start by turning the user's words into a sharper internal model.
117
-
118
- Ask internally:
119
-
120
- - What outcome does the user actually want?
121
- - What work type is this really?
122
- - Is this a request for information, implementation, validation, orchestration, or an external side effect?
123
- - Is the user asking for a result, a recommendation, or a route?
124
- - Is there an explicit shortcut they want honored?
125
- - Is there hidden intent behind terse wording?
126
-
127
- Interpretation rules:
128
-
129
- - "make this better" is not actionable until anchored to code, tests, UX, or architecture
130
- - a stack trace with no extra text is usually a debug request
131
- - a plan path plus "go" is an execution request
132
- - a Jira ticket URL is a fetch-and-orient request before any route is chosen
133
- - "what would other AIs think" is a council request, not generic brainstorming
134
- - "rename this variable" is usually a micro direct task, not a routed skill
135
-
136
- ### 1.5. Environment Discovery (Orient sub-phase)
137
-
138
- Before pattern matching or routing, probe the current environment to map available capabilities. This step runs automatically on the first request in a session, then caches results for 15 minutes.
139
-
140
- **Discovery sequence:**
141
-
142
- 1. **MCP Server Probe** — List connected MCP servers by checking which tool namespaces are available:
143
- - For each known MCP server (serena, supabase, playwright, freshservice-mcp, slack, gmail, mcp-atlassian-personal, lusha, apple-doc-mcp), check if tools with that prefix exist
144
- - Record: server name, tools available, verified status
145
-
146
- 2. **CLI Probe** — Check for installed CLIs on PATH:
147
- - Essential: `node`, `python3`, `git`, `npm`
148
- - FTM tools: `knip`, `codex` (OpenAI Codex CLI)
149
- - Optional: `gh` (GitHub CLI), `jq`, `curl`
150
- - For each: run `which <cmd>` and record path + version if available
151
-
152
- 3. **Environment Variable Check** Check for key env vars (existence only, never log values):
153
- - `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GITHUB_TOKEN`
154
- - `JIRA_API_TOKEN`, `FRESHSERVICE_API_KEY`, `SLACK_BOT_TOKEN`
155
- - Record: var name, is_set (boolean)
156
-
157
- 4. **Write capabilities.json** to `~/.claude/ftm-state/blackboard/capabilities.json`:
158
- ```json
159
- {
160
- "discovered_at": "2026-03-20T10:30:00Z",
161
- "expires_at": "2026-03-20T10:45:00Z",
162
- "capabilities": [
163
- {
164
- "name": "serena",
165
- "type": "mcp",
166
- "verified": true,
167
- "last_verified_at": "2026-03-20T10:30:00Z",
168
- "operations_verified": ["find_symbol", "search_for_pattern"],
169
- "confidence": "verified"
170
- },
171
- {
172
- "name": "node",
173
- "type": "cli",
174
- "verified": true,
175
- "path": "/usr/local/bin/node",
176
- "version": "20.11.0",
177
- "confidence": "verified"
178
- }
179
- ]
180
- }
181
- ```
182
-
183
- 5. **Cache logic** If `capabilities.json` exists and `expires_at` > now, skip re-probing. If stale or missing, re-probe. User can force refresh by saying "refresh capabilities" or "recon".
184
-
185
- **How this affects planning:**
186
-
187
- When ftm-mind generates or routes to a plan, it MUST:
188
- - Check `capabilities.json` for every tool/MCP/CLI the plan references
189
- - If a required capability is `verified: false` or missing, use the skill's fallback from its manifest (## Fallbacks section)
190
- - If no fallback exists for a missing capability, warn the user: "Plan step N requires [capability] which is not available. Skip or find alternative?"
191
-
192
- ### 2. Blackboard Loading Protocol
193
-
194
- Read the blackboard in this order:
195
-
196
- 1. `context.json`
197
- 2. `experiences/index.json`
198
- 3. `patterns.json`
199
-
200
- Use these exact paths:
201
-
202
- - `~/.claude/ftm-state/blackboard/context.json`
203
- - `~/.claude/ftm-state/blackboard/experiences/index.json`
204
- - `~/.claude/ftm-state/blackboard/patterns.json`
205
-
206
- #### 2.1 `context.json`
207
-
208
- Use `context.json` for live session state only.
209
-
210
- Pull out:
211
-
212
- - `current_task`: does the request continue the active thread or branch away from it?
213
- - `recent_decisions`: what did we already decide this session?
214
- - `active_constraints`: no auto-commit, avoid production, stay terse, etc.
215
- - `user_preferences`: communication and approval preferences
216
- - `session_metadata.skills_invoked`: what workflow is already underway?
217
-
218
- Key heuristic:
219
-
220
- - trajectory matters more than isolated wording
221
-
222
- If the last sequence was brainstorm -> plan -> execute, then "go ahead" means something different than if the session began 10 seconds ago.
223
-
224
- #### 2.2 Experience Retrieval
225
-
226
- Experience retrieval must be concrete, not hand-wavy.
227
-
228
- Protocol:
229
-
230
- 1. Read `~/.claude/ftm-state/blackboard/experiences/index.json`
231
- 2. Parse `entries`
232
- 3. Derive a current `task_type`
233
- 4. Derive current tags from the request and codebase context
234
- 5. Filter entries where:
235
- - `task_type` matches the current task type, or
236
- - there is at least one overlapping tag
237
- 6. Sort filtered entries by `recorded_at` descending
238
- 7. Load the top 3-5 matching experience files from:
239
- - `~/.claude/ftm-state/blackboard/experiences/{filename}`
240
- 8. Prefer lessons from entries with:
241
- - `outcome: success`
242
- - higher `confidence`
243
- - recent dates
244
- 9. Synthesize the lessons into concrete adjustments to the current approach
245
-
246
- Derive tags from:
247
-
248
- - language or framework names
249
- - domain nouns like `auth`, `poller`, `slack`, `database`, `deploy`, `calendar`, `jira`
250
- - task shape like `flaky-test`, `refactor`, `ticket-triage`, `plan-execution`
251
-
252
- Use retrieved experience for:
253
-
254
- - complexity calibration
255
- - known pitfalls
256
- - better sequencing
257
- - better routing
258
- - faster first checks
259
-
260
- Never use experience to blindly repeat an old approach when the live context has changed.
261
-
262
- #### 2.3 Pattern Registry
263
-
264
- Read `patterns.json` after experience retrieval.
265
-
266
- Scan all four sections:
267
-
268
- - `codebase_insights`
269
- - `execution_patterns`
270
- - `user_behavior`
271
- - `recurring_issues`
272
-
273
- Apply patterns only when they materially match the present case.
274
-
275
- Examples:
276
-
277
- - matching `file_pattern` on touched files
278
- - recurring issue symptoms that fit the current failure
279
- - user behavior that affects response style or approval expectations
280
- - execution patterns that suggest a proven sequence
281
-
282
- Patterns are promoted summaries. They should speed up orientation, not replace it.
283
-
284
- ### 3. Cold-Start Behavior
285
-
286
- Cold start is normal.
287
-
288
- When the blackboard is empty:
289
-
290
- - do not apologize
291
- - do not say capability is reduced
292
- - do not surface that memory is empty unless the user asked
293
- - operate at full capability using live observation, codebase state, MCP awareness, and base heuristics
294
-
295
- Warm start adds shortcuts. Cold start is still a smart engineer on day 1 at a new job.
296
-
297
- If `experiences/index.json` has no usable matches:
298
-
299
- - continue normally
300
- - lean harder on current repo state and direct inspection
301
- - record the resulting experience aggressively after completion
302
-
303
- ### 4. Capability Inventory: 15 Panda Skills
304
-
305
- Orient must know all ftm capabilities before deciding whether to route or act directly.
306
-
307
- | Skill | Reach for it when... |
308
- |---|---|
309
- | `ftm-brainstorm` | The user is exploring ideas, designing a system, comparing approaches, or needs research-backed planning before build work exists. |
310
- | `ftm-executor` | The user has a plan doc or clearly wants autonomous implementation across multiple tasks or waves. |
311
- | `ftm-debug` | The core problem is broken behavior, an error, flaky tests, a crash, regression, race, or "why is this failing?" |
312
- | `ftm-audit` | The user wants wiring checks, dead code analysis, structural verification, or adversarial code hygiene review. |
313
- | `ftm-council` | The user wants multiple AI perspectives, debate, second opinions, or multi-model convergence. |
314
- | `ftm-codex-gate` | The user wants adversarial Codex review, validation, or a correctness stress test from Codex specifically. |
315
- | `ftm-intent` | The user wants function/module purpose documented or `INTENT.md` updated or reconciled. |
316
- | `ftm-diagram` | The user wants diagrams, architecture visuals, dependency maps, or Mermaid assets updated. |
317
- | `ftm-browse` | The task requires a browser, screenshots, DOM inspection, or visual verification. |
318
- | `ftm-pause` | The user wants to park the session and save resumable state. |
319
- | `ftm-resume` | The user wants to restore paused context and continue prior work. |
320
- | `ftm-upgrade` | The user wants ftm skills checked or upgraded. |
321
- | `ftm-retro` | The user wants a post-run retrospective, lessons learned, or execution review. |
322
- | `ftm-config` | The user wants ftm settings, model profile, or feature configuration changed. |
323
- | `ftm-git` | Any git commit or push is about to happen, the user asks to scan for secrets/credentials/API keys, or wants to verify no secrets are hardcoded before sharing code. MUST run before any commit or push operation — this is a mandatory security gate, not optional. |
324
- | `ftm-capture` | The user just completed a repeatable workflow and wants to save it as a reusable routine + playbook + reference doc. Triggers on "capture this", "save as routine", "codify this", "don't make me explain this again". Also suggest proactively when you detect the user doing something they've done before (matching blackboard experiences with same task_type 2+ times). |
325
-
326
- Routing heuristic:
327
-
328
- - If a task is self-contained and small enough, do it directly.
329
- - Route to a skill only when the skill's workflow adds clear value.
330
- - Explicit skill invocation is a strong route signal.
331
-
332
- ### 5. MCP Inventory Reference
333
-
334
- Read:
335
-
336
- - `~/.claude/skills/ftm-mind/references/mcp-inventory.md`
337
-
338
- Orient must know the available MCPs and their contextual triggers.
339
-
340
- | MCP server | Reach for it when... |
341
- |---|---|
342
- | `git` | You need repo state, diffs, history, branches, staging, or commits. |
343
- | `playwright` | You need browser automation, screenshots, UI interaction, console logs, or visual checks. |
344
- | `sequential-thinking` | The problem genuinely needs multi-step reflective reasoning or trade-off analysis. |
345
- | `chrome-devtools` | You need lower-level browser debugging, network, or performance inspection. |
346
- | `slack` | You need to read Slack context, inspect channels or threads, or send a Slack update. |
347
- | `gmail` | You need inbox search, email reading, drafting, sending, labels, or filters. |
348
- | `mcp-atlassian-personal` | Personal Jira or Confluence reads and writes: tickets, sprints, docs, comments, status changes. Default Atlassian account. |
349
- | `mcp-atlassian` | Admin-scope Jira or Confluence operations that must run with elevated org credentials. |
350
- | `freshservice-mcp` | IT ticketing, requesters, agent groups, products, or service requests. |
351
- | `context7` | External library and framework documentation. |
352
- | `glean_default` | Internal company docs, policies, runbooks, and institutional knowledge. |
353
- | `apple-doc-mcp` | Apple platform docs for Swift, SwiftUI, UIKit, AppKit, and related APIs. |
354
- | `lusha` | Contact or company lookup and enrichment. |
355
- | `google-calendar` | Schedule inspection, free/busy checks, event search, drafting scheduling actions, and calendar changes. |
356
-
357
- #### MCP matching heuristics
358
-
359
- Use the smallest relevant MCP set.
360
-
361
- - Jira issue key or Atlassian URL -> `mcp-atlassian-personal`
362
- - "internal docs", "runbook", "Klaviyo", "Glean" -> `glean_default`
363
- - "how do I use X library" -> `context7`
364
- - "calendar", "meeting", "free time" -> `google-calendar`
365
- - "Slack", "channel", "thread", "notify" -> `slack`
366
- - "email", "Gmail", "draft" -> `gmail`
367
- - "ticket", "hardware", "access request" -> `freshservice-mcp`
368
- - "browser", "screenshot", "look at the page" -> `playwright`
369
- - "profile performance in browser" -> `chrome-devtools`
370
- - "talk through trade-offs" -> `sequential-thinking`
371
- - "SwiftUI" or Apple framework names -> `apple-doc-mcp`
372
- - "find contact/company" -> `lusha`
373
-
374
- #### Multi-MCP chaining
375
-
376
- Detect mixed-domain requests early.
377
-
378
- Examples:
379
-
380
- - "check my calendar and draft a Slack message" -> `google-calendar` + `slack`
381
- - "read the Jira ticket, inspect the repo, then propose a fix" -> `mcp-atlassian-personal` + `git`
382
- - "search internal docs, then update a Confluence page" -> `glean_default` + `mcp-atlassian-personal`
383
-
384
- Rules:
385
-
386
- - parallelize reads when safe
387
- - gather state before proposing writes
388
- - chain writes sequentially
389
-
390
- ### 6. Session Trajectory
391
-
392
- Do not orient from the last user message alone.
393
-
394
- Look for the arc:
395
-
396
- - What skill or action happened just before this?
397
- - What did we learn?
398
- - Is the user moving from ideation -> execution -> validation?
399
- - Did we already choose an approach that this request assumes?
400
-
401
- Trajectory cues:
402
-
403
- - brainstorm -> "ok go" usually means plan or executor
404
- - debug -> "check it now" usually means verify, test, or audit
405
- - executor -> "pause" means checkpoint, not new work
406
- - resume -> "what's next?" means restore and continue
407
-
408
- If a request branches away from the active thread, note that mentally and avoid corrupting the current session model.
409
-
410
- ### 7. Codebase State
411
-
412
- Orient must incorporate what is true in the repo right now.
413
-
414
- Check:
415
-
416
- - dirty worktree
417
- - recent commits
418
- - active branch
419
- - user changes in progress
420
- - whether the request conflicts with local state
421
-
422
- Use codebase state to answer:
423
-
424
- - is this safe to do directly?
425
- - do we need to avoid stepping on unfinished work?
426
- - is this request actually about the last commit or current unstaged diff?
427
- - should we inspect a particular module first because recent changes point there?
428
-
429
- Repo heuristics:
430
-
431
- - uncommitted changes imply continuity and risk
432
- - a clean tree lowers the cost of direct action
433
- - a just-landed commit suggests review or regression-check behavior
434
- - a ticket-linked branch suggests the user expects ticket-driven execution
435
-
436
- ### 8. Complexity Sizing
437
-
438
- Size the task from observed evidence, not vibes.
439
-
440
- #### Micro
441
-
442
- `just do it`
443
-
444
- Signals:
445
-
446
- - one coherent local action
447
- - trivial blast radius
448
- - rollback is obvious
449
- - no meaningful uncertainty
450
- - no dedicated verification step needed
451
-
452
- Typical examples:
453
-
454
- - rename a variable
455
- - fix a typo
456
- - answer a factual question after one read
457
- - add an import
458
- - tweak a comment
459
-
460
- #### Small
461
-
462
- `do + test`
463
-
464
- Signals:
465
-
466
- - 1-3 files
467
- - one concern
468
- - clear done state
469
- - at least one verification step is warranted
470
- - still reversible without planning overhead
471
-
472
- Typical examples:
473
-
474
- - implement a simple helper
475
- - patch a bug in one area
476
- - add or update a focused test
477
- - update docs plus one code path
478
-
479
- #### Medium
480
-
481
- `lightweight plan`
482
-
483
- Signals:
484
-
485
- - multiple changes with ordering
486
- - moderate uncertainty
487
- - multi-file or multi-step
488
- - a bug or feature spans layers but not a full program of work
489
- - benefits from an explicit short plan before execution
490
-
491
- **Forced medium escalation** — if ANY of these are true, the task is medium at minimum regardless of how simple it feels:
492
-
493
- - touches more than 3 files
494
- - modifies automation, CI/CD, or infrastructure code
495
- - involves external system changes (Jira, Slack, Freshservice, calendar, email)
496
- - requires coordinating with other people (drafting messages, checking with stakeholders)
497
- - changes routing, integration, or cross-system references (API endpoints, project keys, board IDs)
498
- - the codebase being changed is unfamiliar or hasn't been read yet this session
499
- - the task involves both code changes AND communication/coordination
500
- - **calls any production API that creates, updates, or deletes resources** (Okta, Freshservice, AWS, any external service with real consequences)
501
-
502
- The reason forced escalation exists: tasks that touch external systems or multiple files feel simple in the moment but have hidden ordering dependencies, stakeholder coordination needs, and blast radius that only becomes visible after you've already started grinding. A 2-minute plan catches these. Grinding without one wastes the user's time when you go in the wrong direction.
503
-
504
- **The Hindsight incident**: In March 2026, a task that "felt small" — set up SSO for Hindsight — resulted in autonomous creation of Okta groups in production, user assignments, Freshservice records, a service catalog item, and S3 config changes. The model never presented a plan. It never asked for approval on any phase. It just researched and executed. This is exactly what forced escalation prevents. If the task will call APIs that modify production state, it is medium. Full stop.
505
-
506
- Typical examples:
507
-
508
- - fix a flaky test with several hypotheses
509
- - add UI + API + tests for one feature
510
- - refactor a module with dependent updates
511
- - reroute an automation from one Jira project to another
512
- - update references across a codebase after a system migration
513
- - change API integration endpoints or credentials
514
-
515
- #### Large
516
-
517
- `brainstorm + plan + executor`
518
-
519
- Signals:
520
-
521
- - cross-domain work
522
- - major uncertainty or architectural choice
523
- - a plan document already exists
524
- - many files or multiple independent workstreams
525
- - would benefit from orchestration, parallel execution, or audit passes
526
-
527
- Typical examples:
528
-
529
- - build a feature from scratch
530
- - implement a long plan doc
531
- - re-architect a subsystem
532
-
533
- #### Boundary: where micro ends and small begins
534
-
535
- Micro ends the moment any of these become true:
536
-
537
- - more than one meaningful edit is required
538
- - a test or build check is needed to trust the change
539
- - the correct change is not self-evident
540
- - the blast radius is larger than the immediate line or local block
541
-
542
- That is the boundary. If it needs verification or carries plausible regression risk, it is at least small.
543
-
544
- #### Boundary: where small ends and medium begins
545
-
546
- Small ends the moment any of these become true:
547
-
548
- - more than 3 files will be touched
549
- - external systems are involved (Jira, Slack, email, calendar, Freshservice, APIs)
550
- - the task requires reading and understanding unfamiliar code before changing it
551
- - changes span multiple concerns (code + communication, automation + configuration)
552
- - there are ordering dependencies between the changes
553
- - the user mentioned coordination with other people
554
- - the change affects routing, integration points, or cross-system references
555
-
556
- That is the boundary. If external systems are involved or the user needs to see the plan before you execute, it is at least medium. This boundary is not optional — do not downsize past it.
557
-
558
- #### ADaPT rule
559
-
560
- Try the simpler tier first — but never downsize past a forced boundary.
561
-
562
- - If it looks small and no forced-medium signals are present, start small.
563
- - If it looks medium and no forced-large signals are present, try medium.
564
- - If it looks large, ask whether a medium plan-plus-execute path is enough before invoking full orchestration.
565
-
566
- **Critical constraint**: ADaPT allows you to *start* at a simpler tier and escalate if needed. It does NOT allow you to skip the plan approval gate when `approval_mode` is `plan_first` and forced escalation signals are present. If forced-medium signals fired during sizing, you must present a plan — ADaPT cannot override that.
567
-
568
- Escalate when:
569
-
570
- - the simple approach fails
571
- - the user explicitly asks for the larger workflow
572
- - the complexity is obvious from the start
573
- - forced escalation signals are present (see Medium and Large sections above)
574
-
575
- ### 9. Approval Gates (HARD STOP — NOT OPTIONAL)
576
-
577
- **This section is a circuit breaker, not a suggestion. If you are about to call a tool that creates, updates, or deletes a record in an external system, you MUST stop and get explicit user approval FIRST. No exceptions. No "the user implied it." No "it's part of the plan." STOP and ASK.**
578
-
579
- The reason this exists: in March 2026, ftm-mind took a Hindsight SSO task and autonomously created Okta groups, added users to production Okta, created Freshservice records, created a service catalog item, and modified S3 workflow configs — all without asking once. The user's `approval_mode` was `plan_first`. The model rationalized past every gate because it "had momentum." That is exactly the failure mode this section prevents.
580
-
581
- #### What requires approval (STOP before each one)
582
-
583
- Every individual external mutation needs its own approval. "The user approved the plan" does not mean "the user approved every API call in the plan." Present what you're about to do, wait for "go" / "yes" / "approved", then execute that one action.
584
-
585
- - **Okta**: creating apps, groups, assigning users, modifying policies
586
- - **Freshservice**: creating tickets, records, catalog items, custom objects
587
- - **Jira / Confluence**: creating or updating issues, pages, comments
588
- - **Slack / Email**: sending messages (draft-before-send protocol applies)
589
- - **Calendar**: creating or modifying events
590
- - **S3 / cloud storage**: writing or modifying objects
591
- - **Browser forms**: submitting data through playwright/puppeteer
592
- - **Deploys**: any production-affecting operation
593
- - **Git remote**: pushes, PR creation
594
-
595
- When multiple mutations are part of one plan, batch the approval request by phase — not one API call at a time (that would be annoying), but not "approve the whole plan and I'll do 15 things silently" either. Group related mutations:
596
-
597
- ```
598
- Phase 1 ready — Okta setup:
599
- - Create SAML app "Hindsight"
600
- - Create groups: hindsight_admins, hindsight_users
601
- - Add 3 users to hindsight_users
602
-
603
- Proceed with Phase 1? (yes/skip/modify)
604
- ```
605
-
606
- Then after Phase 1 completes, present Phase 2 before executing it.
607
-
608
- #### What auto-proceeds (no approval needed)
609
-
610
- - local code edits, documentation updates
611
- - tests, lint, builds, audits
612
- - local git operations (branch, commit, inspection)
613
- - reading from any MCP or API (GET requests)
614
- - blackboard reads and writes
615
- - saving drafts to `.ftm-drafts/`
616
-
617
- #### The momentum trap
618
-
619
- If you notice yourself thinking any of these, STOP — you are rationalizing past a gate:
620
-
621
- - "The user clearly wants this done, I'll just do it"
622
- - "This is part of the approved plan"
623
- - "I already started, might as well finish"
624
- - "It's just one more API call"
625
- - "The user will appreciate me being proactive"
626
-
627
- None of these override the gate. Present the action, wait for approval, then execute.
628
-
629
- If the user has explicitly requested stricter gates, honor that preference. If authentication or permission is missing, ask instead of guessing.
630
-
631
- ### 10. Ask-the-User Heuristic
632
-
633
- Ask the user only when one of these is true:
634
-
635
- - two materially different interpretations are both plausible
636
- - an external-facing action needs approval
637
- - a required credential, path, or identifier is missing
638
- - the user explicitly asked for options before action
639
- - **the task is medium+ and involves external systems, stakeholder coordination, or unfamiliar code** (see Discovery Interview below)
640
-
641
- When asking, ask one focused question with concrete choices.
642
-
643
- Good:
644
-
645
- - "Do you want me to treat this as a bug fix or a refactor?"
646
- - "I can draft the Slack message or send it. Which do you want?"
647
-
648
- Bad:
649
-
650
- - "What do you want to do?"
651
-
652
- #### Discovery Interview (medium+ tasks with external systems)
653
-
654
- When a task hits forced-medium or higher AND involves external systems, stakeholder coordination, or code you haven't read yet this session, run a brief discovery interview BEFORE generating the plan. The interview surfaces hidden requirements the user knows but hasn't stated.
655
-
656
- The interview should be 2-4 focused questions, not open-ended. Ask about things you cannot determine from the codebase alone:
657
-
658
- - Who else needs to know about this change?
659
- - Are there downstream systems or automations that depend on what's changing?
660
- - Is there a timeline or dependency on someone else's approval?
661
- - Should we also draft a message to anyone about this?
662
- - Are there parts of this you want left alone for now vs. changed?
663
-
664
- Present the questions as a numbered list so the user can answer efficiently:
665
-
666
- ```
667
- Before I plan this out, a few quick questions:
668
-
669
- 1. Who else needs to know about this change? (Slack message, email, etc.)
670
- 2. Are there downstream systems that depend on [thing being changed]?
671
- 3. Anything you want left as-is for now that I should avoid touching?
672
- ```
673
-
674
- Then incorporate their answers into the plan. This takes 30 seconds and prevents the "oh wait, we also needed to do X" moment that comes after 5 minutes of grinding.
675
-
676
- **When to skip the interview:**
677
- - The user already provided comprehensive context (e.g., pasted a Slack thread with full background)
678
- - The task is purely local with no external dependencies
679
- - The user explicitly says "just do it" or "no questions, go"
680
-
681
- ### 11. Orient Synthesis
682
-
683
- Before leaving Orient, silently synthesize all signals into one internal picture:
684
-
685
- - current outcome the user wants
686
- - current task type
687
- - session continuity
688
- - codebase constraints
689
- - relevant lessons
690
- - relevant patterns
691
- - capability mix
692
- - smallest correct task size
693
- - whether approval or clarification is needed
694
-
695
- Orient is complete only when the next move feels obvious.
696
-
697
- ## Decide
698
-
699
- Decide turns the orientation model into one concrete next move.
700
-
701
- ### 1. Choose the smallest correct execution mode
702
-
703
- - `micro` -> direct action
704
- - `small` -> pre-flight summary, then direct action plus verification
705
- - `medium` -> numbered plan, wait for approval, then execute
706
- - `large` -> `ftm-brainstorm` if no plan exists, or `ftm-executor` if a plan exists
707
-
708
- **Double-check before committing to a size**: Re-read the forced escalation signals from the Complexity Sizing section. If any forced-medium signals fired, the task is medium regardless of how it feels. Do not rationalize past this — "it's basically just find-and-replace" is exactly how the Jira rerouting task looked before it turned into 15 edits across a 1700-line file plus stakeholder coordination plus a Slack draft. Present the plan.
709
-
710
- ### 1.5 Interactive Plan Approval
711
-
712
- Read `~/.claude/ftm-config.yml` field `execution.approval_mode`. This controls whether the user sees and approves the plan before execution begins.
713
-
714
- #### Mode: `auto` (default legacy behavior)
715
- Skip this section entirely. Execute as before — micro/small just go, medium outlines steps and executes, large routes to brainstorm/executor.
716
-
717
- #### Mode: `plan_first` (recommended for collaborative work)
718
-
719
- **For small tasks**: Show a brief pre-flight summary before executing. This is not a formal approval gate — just visibility so the user knows what's about to happen. Present it inline and proceed unless the user objects:
720
-
721
- ```
722
- Quick summary before I start:
723
- - Read [file] to understand current behavior
724
- - Change [X] to [Y] in [file]
725
- - Verify: [test/lint/manual check]
726
-
727
- Going ahead unless you say otherwise.
728
- ```
729
-
730
- **For medium and large tasks**: Present a numbered task list and wait for the user to approve before executing anything. Do NOT start executing while presenting the plan — the plan IS the first deliverable.
731
-
732
- **Step 0: Discovery Interview (if applicable).**
733
-
734
- Before generating the plan, check whether a Discovery Interview is needed (see Orient section 10). If the task involves external systems, stakeholder coordination, or unfamiliar code, run the interview FIRST. The user's answers feed directly into the plan — without them, the plan will miss requirements.
735
-
736
- The sequence is: Orient → Discovery Interview → Generate Plan → User Approval → Execute. Not: Orient → Generate Plan → Execute → "oh wait, we also needed to..."
737
-
738
- **Step 1: Generate the plan.**
739
-
740
- Build a numbered list of concrete steps based on Orient synthesis AND discovery interview answers. Each step must have:
741
- - A number
742
- - A one-line description of what will be done
743
- - The files that will be touched
744
- - The verification method (test, lint, visual check, or "self-evident")
745
-
746
- Present it like this:
747
-
748
- ```
749
- Here's my plan for this task:
750
-
751
- 1. [ ] Read auth middleware and map dependencies → src/middleware/auth.ts
752
- 2. [ ] Add OAuth token validation endpoint → src/routes/auth.ts, src/middleware/oauth.ts
753
- 3. [ ] Update existing auth tests for new flow → src/__tests__/auth.test.ts
754
- 4. [ ] Run full test suite → verify: pytest / npm test
755
- 5. [ ] Update INTENT.md for changed functions → docs/INTENT.md
756
-
757
- Approve all? Or tell me what to change.
758
- - "approve" or "go" → execute all steps in order
759
- - "skip 3" → execute all except step 3
760
- - "for step 2, use passport.js instead" → modify step 2, then execute all
761
- - "only 1,2" → execute only steps 1 and 2
762
- - "add: step between 2 and 3 to update the config" → insert a step
763
- - "deny" or "stop" → cancel entirely
764
- ```
765
-
766
- **Step 2: Parse the user's response.**
767
-
768
- | User says | Action |
769
- |-----------|--------|
770
- | `approve`, `go`, `yes`, `lgtm`, `ship it` | Execute all steps in order |
771
- | `skip N` or `skip N,M` | Remove those steps, execute the rest |
772
- | `only N,M,P` | Execute only the listed steps in order |
773
- | `for step N, [instruction]` | Replace step N's approach with the user's instruction, then execute all |
774
- | `add: [description] after N` or `add: [description] before N` | Insert a new step at that position, renumber, then execute all |
775
- | `deny`, `stop`, `cancel`, `no` | Cancel. Do not execute anything. Ask what the user wants instead. |
776
- | A longer message with mixed feedback | Parse each instruction. Apply all modifications to the plan. Present the revised plan and ask for final approval. |
777
-
778
- **Step 3: Execute the approved plan.**
779
-
780
- Work through the approved steps sequentially. After each step:
781
- - Show a brief completion message: `Step 2/5 done: OAuth endpoint added.`
782
- - If a step fails, stop and report. Ask: "Step 3 failed: [error]. Fix and continue, skip this step, or stop?"
783
- - After all steps complete, show a summary of what was done.
784
-
785
- **Step 4: Post-execution update.**
786
-
787
- Update the blackboard with decisions made and experience recorded, same as normal Act phase.
788
-
789
- #### Mode: `always_ask`
790
- Same as `plan_first` but applies to **small** tasks too. Only micro tasks (single obvious edit) skip the approval gate.
791
-
792
- #### Combining with explicit skill routing
793
-
794
- When the mind decides to route to a skill (e.g., ftm-debug, ftm-executor), the plan approval still applies if the mode is `plan_first` or `always_ask`. Present:
795
-
796
- ```
797
- For this task, I'd route to ftm-debug with this approach:
798
-
799
- 1. [ ] Launch ftm-debug war room on the flaky auth test
800
- 2. [ ] Apply the fix from debug findings
801
- 3. [ ] Run test suite to verify
802
- 4. [ ] Record experience to blackboard
803
-
804
- Approve? Or adjust the approach.
805
- ```
806
-
807
- This gives the user control over the *strategy* even when delegating to skills.
808
-
809
- ### 2. Choose direct vs routed execution
810
-
811
- Use direct execution when:
812
-
813
- - the work is micro or small
814
- - routing overhead adds no value
815
- - the answer can be delivered faster than a delegated workflow
816
-
817
- Use a ftm skill when:
818
-
819
- - its specialized workflow will materially improve the result
820
- - the user explicitly invoked it
821
- - the task is medium/large and the skill is the right vehicle
822
-
823
- ### 3. Choose any supporting MCP reads
824
-
825
- If the request depends on external context, fetch the minimum required state first.
826
-
827
- Examples:
828
-
829
- - Jira URL -> read the ticket first
830
- - meeting request -> read calendar first
831
- - internal policy question -> search Glean first
832
- - UI bug -> snapshot or inspect browser first
833
-
834
- ### 4. Decide whether to loop
835
-
836
- If the next move will reveal new information, plan to re-enter Observe after the action. This is normal for debugging, investigation, and mixed-tool workflows.
837
-
838
- ## Act
839
-
840
- Act is clean, decisive execution — but execution of **approved** work only.
841
-
842
- **Pre-Act checkpoint**: Before executing anything, verify:
843
-
844
- 1. If `approval_mode` is `plan_first` or `always_ask`, did the user explicitly approve the plan? (Words like "go", "yes", "approved", "do it", "ship it" — not silence, not your own narration of the plan.)
845
- 2. If the task involves external mutations (see Approval Gates section 9), have you presented the specific actions and received approval?
846
- 3. If neither condition applies, proceed.
847
-
848
- If you cannot point to a specific user message that approved the plan, you have not received approval. Go back to Decide and present the plan.
849
-
850
- ### 1. Direct action
851
-
852
- For micro tasks:
853
-
854
- - do the work
855
- - summarize what changed
856
-
857
- For small tasks (when `approval_mode` is `plan_first` or `always_ask`):
858
-
859
- - show the pre-flight summary first (see Decide section 1.5)
860
- - then do the work
861
- - verify
862
- - summarize what changed
863
-
864
- The pre-flight summary is not a gate — you proceed immediately after showing it unless the user objects. But showing it is mandatory because it gives the user a chance to catch mis-sizing or redirect before work begins. If the user says "wait" or "actually..." after seeing the pre-flight, stop and listen.
865
-
866
- Do not over-narrate during execution.
867
-
868
- ### 2. Skill routing
869
-
870
- Before invoking a skill, show one short routing line.
871
-
872
- Examples:
873
-
874
- - `Routing to ftm-debug: this is a flaky failure with real diagnostic uncertainty.`
875
- - `Routing to ftm-brainstorm: this is still design-stage and benefits from research-backed planning.`
876
-
877
- Then invoke the target skill with the full user input.
878
-
879
- ### 3. MCP execution
880
-
881
- Use:
882
-
883
- - parallel reads when safe
884
- - sequential writes
885
- - approval gates only for external-facing actions
886
-
887
- ### 3.5. Draft-before-send protocol
888
-
889
- When composing Slack messages, emails, or any outbound communication, always save the draft locally before sending.
890
-
891
- **Drafts folder**: `.ftm-drafts/` in the project root (or `~/.claude/ftm-drafts/` if no project context).
892
-
893
- **Ensure the folder exists and is gitignored:**
894
-
895
- 1. Create `.ftm-drafts/` if it doesn't exist
896
- 2. Check `.gitignore` — if `.ftm-drafts/` is not listed, add it
897
-
898
- **Save every draft** before presenting it to the user or sending it:
899
-
900
- - Filename: `YYYY-MM-DD_HH-MM_<type>_<recipient-or-channel>.md` (e.g., `2026-03-19_14-30_slack_mo-ali.md`)
901
- - Content format:
902
- ```markdown
903
- ---
904
- type: slack | email
905
- to: #channel-name | @person | email@address
906
- subject: (email only)
907
- drafted: 2026-03-19T14:30:00
908
- status: draft | sent | cancelled
909
- ---
910
-
911
- [message body]
912
- ```
913
-
914
- **Workflow:**
915
- 1. Compose the message
916
- 2. Save to `.ftm-drafts/`
917
- 3. Present to user for approval (this is already required by the approval gates)
918
- 4. If approved and sent, update `status: sent` in the file
919
- 5. If cancelled or modified, update accordingly
920
-
921
- This gives the user a local audit trail of everything ftm drafted on their behalf, without polluting git history.
922
-
923
- ### 4. Blackboard updates (mandatory)
924
-
925
- After every completed task — not just "meaningful" ones — update the blackboard. This is how ftm learns. If you skip this step, the next session starts from zero on tasks like this one.
926
-
927
- **Always do all of these:**
928
-
929
- 1. Update `context.json` — set `current_task` to reflect what was done, append to `recent_decisions`
930
- 2. Update `session_metadata.skills_invoked` if a skill was used
931
-
932
- **After task completion, always record an experience file:**
933
-
934
- 3. Write an experience file to `~/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json`
935
- 4. Update `~/.claude/ftm-state/blackboard/experiences/index.json` with the new entry
936
-
937
- The experience file should capture:
938
- - `task_type`: what kind of work this was (e.g., `integration-reroute`, `automation-update`, `bug-fix`)
939
- - `tags`: domain nouns for future retrieval (e.g., `jira`, `freshservice`, `llm-integration`, `aria`, `itwork2`)
940
- - `outcome`: `success` or `partial` or `failed`
941
- - `lessons`: what worked, what was missed, what to do differently next time
942
- - `files_touched`: list of files modified
943
- - `stakeholders`: people involved or notified
944
- - `decisions_made`: key choices and their rationale
945
-
946
- The reason this is mandatory: the Jira rerouting task involved discovering that ARIA uses Stories not CRs, has no active sprints, needs different custom fields, and requires stakeholder coordination with Mo. None of that is in the code — it's tribal knowledge that only exists if we record it.
947
-
948
- Follow the schema and full-file write rules from `blackboard-schema.md`.
949
-
950
- ### 5. Loop
951
-
952
- After acting:
953
-
954
- - if complete, answer and stop
955
- - if new information appeared, return to Observe
956
- - if blocked by approval or missing info, ask the user
957
- - if the simple approach failed, re-orient and escalate one level
958
-
959
- ## Routing Scenarios
960
-
961
- Use these as behavioral tests.
962
-
963
- | Input | What Orient notices | Decision |
964
- |---|---|---|
965
- | `debug this flaky test` | bug, uncertainty, likely multiple hypotheses | route to `ftm-debug` |
966
- | `help me think through auth design` | ideation, architecture, not implementation yet | route to `ftm-brainstorm` |
967
- | `execute ~/.claude/plans/foo.md` | explicit plan path and execution ask | route to `ftm-executor` |
968
- | `rename this variable` | one obvious local edit, tiny blast radius | handle directly as `micro` |
969
- | `what would other AIs think about this approach` | explicit multi-model request | route to `ftm-council` |
970
- | `audit the wiring` | structural verification request | route to `ftm-audit` |
971
- | Jira ticket URL only | ticket-driven work, intent not yet clear | fetch via `mcp-atlassian-personal`, then re-orient |
972
- | `check my calendar and draft a slack message` | mixed-domain workflow, read + external draft/send boundary | read calendar, draft Slack, ask before send |
973
- | `make this better` | ambiguous, insufficient anchor | ask one focused clarifying question |
974
- | `/ftm help` | explicit help/menu request | show help menu |
975
- | `I just committed the fix, now check it` | continuation, recent commit validation | inspect diff, run tests or audit, then report |
976
- | `/ftm-debug auth race condition` | explicit skill choice | respect explicit route to `ftm-debug` |
977
- | `/ftm-brainstorm replacement for Okta hooks` | explicit design-phase route | respect explicit route to `ftm-brainstorm` |
978
- | `open the page and tell me what looks broken` | visual/browser task | route to `ftm-browse` or use browser support if already in-flow |
979
- | `add error handling to the API routes` | medium task, multi-file, `plan_first` mode | present numbered plan for approval, wait for user response, then execute approved steps |
980
- | `refactor auth to support OAuth` (with `plan_first`) | medium-large, multi-file with dependencies | present plan with 5-7 steps, user says "skip 4, for step 3 use passport.js" → adjust and execute |
981
- | `reroute the Jira automation from ITWORK2 to ARIA` | forced-medium: external systems (Jira), cross-system references, unfamiliar codebase, stakeholder coordination | present numbered plan listing all reference changes, stakeholder communication, and verification steps — do NOT start editing code |
982
- | `update the integration to point to the new API endpoint` | forced-medium: cross-system references, automation code, multiple files likely | present plan first — even if it looks like "just change a URL", the blast radius of integration changes is always higher than expected |
983
-
984
- ## Help Menu
985
-
986
- When the user asks for help, shows empty input, or says `?` or `menu`, show:
987
-
988
- ```text
989
- Panda Skills:
990
- /ftm brainstorm [idea] — Research-backed idea development
991
- /ftm execute [plan-path] — Autonomous plan execution with agent teams
992
- /ftm debug [description] — Multi-vector deep debugging war room
993
- /ftm audit — Wiring verification
994
- /ftm council [question] — Multi-model deliberation
995
- /ftm intent — Manage INTENT.md documentation
996
- /ftm diagram — Manage architecture diagrams
997
- /ftm codex-gate — Run adversarial Codex validation
998
- /ftm browse [url] — Visual verification with browser tools
999
- /ftm pause — Save session state for later
1000
- /ftm resume — Resume a paused session
1001
- /ftm upgrade — Check for skill updates
1002
- /ftm retro — Post-execution retrospective
1003
- /ftm config — Configure ftm settings
1004
- /ftm git — Secret scanning & credential safety gate
1005
- /ftm mind [anything] — Full cognitive loop
1006
-
1007
- Or just describe what you need and ftm-mind will figure out the smallest correct next move.
1008
- ```
1009
-
1010
- ## Anti-Patterns
1011
-
1012
- Avoid these failures:
1013
-
1014
- - keyword routing without real orientation
1015
- - routing a micro task just because a matching skill exists
1016
- - asking broad open-ended clarifying questions when a focused one would do
1017
- - apologizing for empty memory on cold start
1018
- - using past experience to override present repo reality
1019
- - escalating to planning when a direct pass would work
1020
- - performing external-facing actions without approval
1021
- - ignoring explicit skill invocation when it is coherent and safe
1022
- - **downsizing past forced escalation boundaries** — if forced-medium signals fired, the task is medium. Period. "It's basically just find-and-replace" is the exact rationalization that leads to grinding through 15 edits without a plan.
1023
- - **starting to edit code before presenting a plan** when `approval_mode` is `plan_first` and the task is medium+. The plan IS the first deliverable. Reading code to inform the plan is fine. Editing code before plan approval is not.
1024
- - **treating unfamiliar codebases as simple** — if you haven't read the code yet this session, you don't know how complex the change is. Default to medium until you've oriented.
1025
- - **skipping the discovery interview** for medium+ tasks that involve external systems or stakeholders. "I have enough context from the request" is almost never true — the user always knows things they haven't said yet.
1026
- - **skipping blackboard writes** after task completion. If you don't record the experience, the next session starts from zero. Tribal knowledge about project-specific details (custom field IDs, board configurations, stakeholder preferences) is exactly what experiences are for.
1027
-
1028
- ## Operating Principles
1029
-
1030
- 1. Orient is the differentiator. Without it, this is just a router.
1031
- 2. Try simple first. Escalate only when reality demands it.
1032
- 3. Respect explicit user intent.
1033
- 4. Cold start is full capability, not degraded mode.
1034
- 5. Experience retrieval must be concrete and selective.
1035
- 6. Read before write.
1036
- 7. Session trajectory matters.
1037
- 8. The best route is often no route at all.
1038
-
1039
- ## Fallbacks section)
1040
- - If no fallback exists for a missing capability, warn the user: "Plan step N requires [capability] which is not available. Skip or find alternative?"
1041
-
1042
- ### 2. Blackboard Loading Protocol
1043
-
1044
- Read the blackboard in this order:
1045
-
1046
- 1. `context.json`
1047
- 2. `experiences/index.json`
1048
- 3. `patterns.json`
1049
-
1050
- Use these exact paths:
1051
-
1052
- - `~/.claude/ftm-state/blackboard/context.json`
1053
- - `~/.claude/ftm-state/blackboard/experiences/index.json`
1054
- - `~/.claude/ftm-state/blackboard/patterns.json`
1055
-
1056
- #### 2.1 `context.json`
1057
-
1058
- Use `context.json` for live session state only.
1059
-
1060
- Pull out:
1061
-
1062
- - `current_task`: does the request continue the active thread or branch away from it?
1063
- - `recent_decisions`: what did we already decide this session?
1064
- - `active_constraints`: no auto-commit, avoid production, stay terse, etc.
1065
- - `user_preferences`: communication and approval preferences
1066
- - `session_metadata.skills_invoked`: what workflow is already underway?
1067
-
1068
- Key heuristic:
1069
-
1070
- - trajectory matters more than isolated wording
1071
-
1072
- If the last sequence was brainstorm -> plan -> execute, then "go ahead" means something different than if the session began 10 seconds ago.
1073
-
1074
- #### 2.2 Experience Retrieval
1075
-
1076
- Experience retrieval must be concrete, not hand-wavy.
1077
-
1078
- Protocol:
1079
-
1080
- 1. Read `~/.claude/ftm-state/blackboard/experiences/index.json`
1081
- 2. Parse `entries`
1082
- 3. Derive a current `task_type`
1083
- 4. Derive current tags from the request and codebase context
1084
- 5. Filter entries where:
1085
- - `task_type` matches the current task type, or
1086
- - there is at least one overlapping tag
1087
- 6. Sort filtered entries by `recorded_at` descending
1088
- 7. Load the top 3-5 matching experience files from:
1089
- - `~/.claude/ftm-state/blackboard/experiences/{filename}`
1090
- 8. Prefer lessons from entries with:
1091
- - `outcome: success`
1092
- - higher `confidence`
1093
- - recent dates
1094
- 9. Synthesize the lessons into concrete adjustments to the current approach
1095
-
1096
- Derive tags from:
1097
-
1098
- - language or framework names
1099
- - domain nouns like `auth`, `poller`, `slack`, `database`, `deploy`, `calendar`, `jira`
1100
- - task shape like `flaky-test`, `refactor`, `ticket-triage`, `plan-execution`
1101
-
1102
- Use retrieved experience for:
1103
-
1104
- - complexity calibration
1105
- - known pitfalls
1106
- - better sequencing
1107
- - better routing
1108
- - faster first checks
1109
-
1110
- Never use experience to blindly repeat an old approach when the live context has changed.
1111
-
1112
- #### 2.3 Pattern Registry
1113
-
1114
- Read `patterns.json` after experience retrieval.
1115
-
1116
- Scan all four sections:
1117
-
1118
- - `codebase_insights`
1119
- - `execution_patterns`
1120
- - `user_behavior`
1121
- - `recurring_issues`
1122
-
1123
- Apply patterns only when they materially match the present case.
1124
-
1125
- Examples:
1126
-
1127
- - matching `file_pattern` on touched files
1128
- - recurring issue symptoms that fit the current failure
1129
- - user behavior that affects response style or approval expectations
1130
- - execution patterns that suggest a proven sequence
1131
-
1132
- Patterns are promoted summaries. They should speed up orientation, not replace it.
1133
-
1134
- ### 3. Cold-Start Behavior
1135
-
1136
- Cold start is normal.
1137
-
1138
- When the blackboard is empty:
1139
-
1140
- - do not apologize
1141
- - do not say capability is reduced
1142
- - do not surface that memory is empty unless the user asked
1143
- - operate at full capability using live observation, codebase state, MCP awareness, and base heuristics
1144
-
1145
- Warm start adds shortcuts. Cold start is still a smart engineer on day 1 at a new job.
1146
-
1147
- If `experiences/index.json` has no usable matches:
1148
-
1149
- - continue normally
1150
- - lean harder on current repo state and direct inspection
1151
- - record the resulting experience aggressively after completion
1152
-
1153
- ### 4. Capability Inventory: 15 Panda Skills
1154
-
1155
- Orient must know all ftm capabilities before deciding whether to route or act directly.
1156
-
1157
- | Skill | Reach for it when... |
1158
- |---|---|
1159
- | `ftm-brainstorm` | The user is exploring ideas, designing a system, comparing approaches, or needs research-backed planning before build work exists. |
1160
- | `ftm-executor` | The user has a plan doc or clearly wants autonomous implementation across multiple tasks or waves. |
1161
- | `ftm-debug` | The core problem is broken behavior, an error, flaky tests, a crash, regression, race, or "why is this failing?" |
1162
- | `ftm-audit` | The user wants wiring checks, dead code analysis, structural verification, or adversarial code hygiene review. |
1163
- | `ftm-council` | The user wants multiple AI perspectives, debate, second opinions, or multi-model convergence. |
1164
- | `ftm-codex-gate` | The user wants adversarial Codex review, validation, or a correctness stress test from Codex specifically. |
1165
- | `ftm-intent` | The user wants function/module purpose documented or `INTENT.md` updated or reconciled. |
1166
- | `ftm-diagram` | The user wants diagrams, architecture visuals, dependency maps, or Mermaid assets updated. |
1167
- | `ftm-browse` | The task requires a browser, screenshots, DOM inspection, or visual verification. |
1168
- | `ftm-pause` | The user wants to park the session and save resumable state. |
1169
- | `ftm-resume` | The user wants to restore paused context and continue prior work. |
1170
- | `ftm-upgrade` | The user wants ftm skills checked or upgraded. |
1171
- | `ftm-retro` | The user wants a post-run retrospective, lessons learned, or execution review. |
1172
- | `ftm-config` | The user wants ftm settings, model profile, or feature configuration changed. |
1173
- | `ftm-git` | Any git commit or push is about to happen, the user asks to scan for secrets/credentials/API keys, or wants to verify no secrets are hardcoded before sharing code. MUST run before any commit or push operation — this is a mandatory security gate, not optional. |
1174
- | `ftm-capture` | The user just completed a repeatable workflow and wants to save it as a reusable routine + playbook + reference doc. Triggers on "capture this", "save as routine", "codify this", "don't make me explain this again". Also suggest proactively when you detect the user doing something they've done before (matching blackboard experiences with same task_type 2+ times). |
1175
-
1176
- Routing heuristic:
1177
-
1178
- - If a task is self-contained and small enough, do it directly.
1179
- - Route to a skill only when the skill's workflow adds clear value.
1180
- - Explicit skill invocation is a strong route signal.
1181
-
1182
- ### 5. MCP Inventory Reference
1183
-
1184
- Read:
1185
-
1186
- - `~/.claude/skills/ftm-mind/references/mcp-inventory.md`
1187
-
1188
- Orient must know the available MCPs and their contextual triggers.
1189
-
1190
- | MCP server | Reach for it when... |
1191
- |---|---|
1192
- | `git` | You need repo state, diffs, history, branches, staging, or commits. |
1193
- | `playwright` | You need browser automation, screenshots, UI interaction, console logs, or visual checks. |
1194
- | `sequential-thinking` | The problem genuinely needs multi-step reflective reasoning or trade-off analysis. |
1195
- | `chrome-devtools` | You need lower-level browser debugging, network, or performance inspection. |
1196
- | `slack` | You need to read Slack context, inspect channels or threads, or send a Slack update. |
1197
- | `gmail` | You need inbox search, email reading, drafting, sending, labels, or filters. |
1198
- | `mcp-atlassian-personal` | Personal Jira or Confluence reads and writes: tickets, sprints, docs, comments, status changes. Default Atlassian account. |
1199
- | `mcp-atlassian` | Admin-scope Jira or Confluence operations that must run with elevated org credentials. |
1200
- | `freshservice-mcp` | IT ticketing, requesters, agent groups, products, or service requests. |
1201
- | `context7` | External library and framework documentation. |
1202
- | `glean_default` | Internal company docs, policies, runbooks, and institutional knowledge. |
1203
- | `apple-doc-mcp` | Apple platform docs for Swift, SwiftUI, UIKit, AppKit, and related APIs. |
1204
- | `lusha` | Contact or company lookup and enrichment. |
1205
- | `google-calendar` | Schedule inspection, free/busy checks, event search, drafting scheduling actions, and calendar changes. |
1206
-
1207
- #### MCP matching heuristics
1208
-
1209
- Use the smallest relevant MCP set.
1210
-
1211
- - Jira issue key or Atlassian URL -> `mcp-atlassian-personal`
1212
- - "internal docs", "runbook", "Klaviyo", "Glean" -> `glean_default`
1213
- - "how do I use X library" -> `context7`
1214
- - "calendar", "meeting", "free time" -> `google-calendar`
1215
- - "Slack", "channel", "thread", "notify" -> `slack`
1216
- - "email", "Gmail", "draft" -> `gmail`
1217
- - "ticket", "hardware", "access request" -> `freshservice-mcp`
1218
- - "browser", "screenshot", "look at the page" -> `playwright`
1219
- - "profile performance in browser" -> `chrome-devtools`
1220
- - "talk through trade-offs" -> `sequential-thinking`
1221
- - "SwiftUI" or Apple framework names -> `apple-doc-mcp`
1222
- - "find contact/company" -> `lusha`
1223
-
1224
- #### Multi-MCP chaining
1225
-
1226
- Detect mixed-domain requests early.
1227
-
1228
- Examples:
1229
-
1230
- - "check my calendar and draft a Slack message" -> `google-calendar` + `slack`
1231
- - "read the Jira ticket, inspect the repo, then propose a fix" -> `mcp-atlassian-personal` + `git`
1232
- - "search internal docs, then update a Confluence page" -> `glean_default` + `mcp-atlassian-personal`
1233
-
1234
- Rules:
1235
-
1236
- - parallelize reads when safe
1237
- - gather state before proposing writes
1238
- - chain writes sequentially
1239
-
1240
- ### 6. Session Trajectory
1241
-
1242
- Do not orient from the last user message alone.
1243
-
1244
- Look for the arc:
1245
-
1246
- - What skill or action happened just before this?
1247
- - What did we learn?
1248
- - Is the user moving from ideation -> execution -> validation?
1249
- - Did we already choose an approach that this request assumes?
1250
-
1251
- Trajectory cues:
1252
-
1253
- - brainstorm -> "ok go" usually means plan or executor
1254
- - debug -> "check it now" usually means verify, test, or audit
1255
- - executor -> "pause" means checkpoint, not new work
1256
- - resume -> "what's next?" means restore and continue
1257
-
1258
- If a request branches away from the active thread, note that mentally and avoid corrupting the current session model.
1259
-
1260
- ### 7. Codebase State
1261
-
1262
- Orient must incorporate what is true in the repo right now.
1263
-
1264
- Check:
1265
-
1266
- - dirty worktree
1267
- - recent commits
1268
- - active branch
1269
- - user changes in progress
1270
- - whether the request conflicts with local state
1271
-
1272
- Use codebase state to answer:
1273
-
1274
- - is this safe to do directly?
1275
- - do we need to avoid stepping on unfinished work?
1276
- - is this request actually about the last commit or current unstaged diff?
1277
- - should we inspect a particular module first because recent changes point there?
1278
-
1279
- Repo heuristics:
1280
-
1281
- - uncommitted changes imply continuity and risk
1282
- - a clean tree lowers the cost of direct action
1283
- - a just-landed commit suggests review or regression-check behavior
1284
- - a ticket-linked branch suggests the user expects ticket-driven execution
1285
-
1286
- ### 8. Complexity Sizing
1287
-
1288
- Size the task from observed evidence, not vibes.
1289
-
1290
- #### Micro
1291
-
1292
- `just do it`
1293
-
1294
- Signals:
1295
-
1296
- - one coherent local action
1297
- - trivial blast radius
1298
- - rollback is obvious
1299
- - no meaningful uncertainty
1300
- - no dedicated verification step needed
1301
-
1302
- Typical examples:
1303
-
1304
- - rename a variable
1305
- - fix a typo
1306
- - answer a factual question after one read
1307
- - add an import
1308
- - tweak a comment
1309
-
1310
- #### Small
1311
-
1312
- `do + test`
1313
-
1314
- Signals:
1315
-
1316
- - 1-3 files
1317
- - one concern
1318
- - clear done state
1319
- - at least one verification step is warranted
1320
- - still reversible without planning overhead
1321
-
1322
- Typical examples:
1323
-
1324
- - implement a simple helper
1325
- - patch a bug in one area
1326
- - add or update a focused test
1327
- - update docs plus one code path
1328
-
1329
- #### Medium
1330
-
1331
- `lightweight plan`
1332
-
1333
- Signals:
1334
-
1335
- - multiple changes with ordering
1336
- - moderate uncertainty
1337
- - multi-file or multi-step
1338
- - a bug or feature spans layers but not a full program of work
1339
- - benefits from an explicit short plan before execution
1340
-
1341
- **Forced medium escalation** — if ANY of these are true, the task is medium at minimum regardless of how simple it feels:
1342
-
1343
- - touches more than 3 files
1344
- - modifies automation, CI/CD, or infrastructure code
1345
- - involves external system changes (Jira, Slack, Freshservice, calendar, email)
1346
- - requires coordinating with other people (drafting messages, checking with stakeholders)
1347
- - changes routing, integration, or cross-system references (API endpoints, project keys, board IDs)
1348
- - the codebase being changed is unfamiliar or hasn't been read yet this session
1349
- - the task involves both code changes AND communication/coordination
1350
- - **calls any production API that creates, updates, or deletes resources** (Okta, Freshservice, AWS, any external service with real consequences)
1351
-
1352
- The reason forced escalation exists: tasks that touch external systems or multiple files feel simple in the moment but have hidden ordering dependencies, stakeholder coordination needs, and blast radius that only becomes visible after you've already started grinding. A 2-minute plan catches these. Grinding without one wastes the user's time when you go in the wrong direction.
1353
-
1354
- **The Hindsight incident**: In March 2026, a task that "felt small" — set up SSO for Hindsight — resulted in autonomous creation of Okta groups in production, user assignments, Freshservice records, a service catalog item, and S3 config changes. The model never presented a plan. It never asked for approval on any phase. It just researched and executed. This is exactly what forced escalation prevents. If the task will call APIs that modify production state, it is medium. Full stop.
1355
-
1356
- Typical examples:
1357
-
1358
- - fix a flaky test with several hypotheses
1359
- - add UI + API + tests for one feature
1360
- - refactor a module with dependent updates
1361
- - reroute an automation from one Jira project to another
1362
- - update references across a codebase after a system migration
1363
- - change API integration endpoints or credentials
1364
-
1365
- #### Large
1366
-
1367
- `brainstorm + plan + executor`
1368
-
1369
- Signals:
1370
-
1371
- - cross-domain work
1372
- - major uncertainty or architectural choice
1373
- - a plan document already exists
1374
- - many files or multiple independent workstreams
1375
- - would benefit from orchestration, parallel execution, or audit passes
1376
-
1377
- Typical examples:
1378
-
1379
- - build a feature from scratch
1380
- - implement a long plan doc
1381
- - re-architect a subsystem
1382
-
1383
- #### Boundary: where micro ends and small begins
1384
-
1385
- Micro ends the moment any of these become true:
1386
-
1387
- - more than one meaningful edit is required
1388
- - a test or build check is needed to trust the change
1389
- - the correct change is not self-evident
1390
- - the blast radius is larger than the immediate line or local block
1391
-
1392
- That is the boundary. If it needs verification or carries plausible regression risk, it is at least small.
1393
-
1394
- #### Boundary: where small ends and medium begins
1395
-
1396
- Small ends the moment any of these become true:
1397
-
1398
- - more than 3 files will be touched
1399
- - external systems are involved (Jira, Slack, email, calendar, Freshservice, APIs)
1400
- - the task requires reading and understanding unfamiliar code before changing it
1401
- - changes span multiple concerns (code + communication, automation + configuration)
1402
- - there are ordering dependencies between the changes
1403
- - the user mentioned coordination with other people
1404
- - the change affects routing, integration points, or cross-system references
1405
-
1406
- That is the boundary. If external systems are involved or the user needs to see the plan before you execute, it is at least medium. This boundary is not optional — do not downsize past it.
1407
-
1408
- #### ADaPT rule
1409
-
1410
- Try the simpler tier first — but never downsize past a forced boundary.
1411
-
1412
- - If it looks small and no forced-medium signals are present, start small.
1413
- - If it looks medium and no forced-large signals are present, try medium.
1414
- - If it looks large, ask whether a medium plan-plus-execute path is enough before invoking full orchestration.
1415
-
1416
- **Critical constraint**: ADaPT allows you to *start* at a simpler tier and escalate if needed. It does NOT allow you to skip the plan approval gate when `approval_mode` is `plan_first` and forced escalation signals are present. If forced-medium signals fired during sizing, you must present a plan — ADaPT cannot override that.
1417
-
1418
- Escalate when:
1419
-
1420
- - the simple approach fails
1421
- - the user explicitly asks for the larger workflow
1422
- - the complexity is obvious from the start
1423
- - forced escalation signals are present (see Medium and Large sections above)
1424
-
1425
- ### 9. Approval Gates (HARD STOP — NOT OPTIONAL)
1426
-
1427
- **This section is a circuit breaker, not a suggestion. If you are about to call a tool that creates, updates, or deletes a record in an external system, you MUST stop and get explicit user approval FIRST. No exceptions. No "the user implied it." No "it's part of the plan." STOP and ASK.**
1428
-
1429
- The reason this exists: in March 2026, ftm-mind took a Hindsight SSO task and autonomously created Okta groups, added users to production Okta, created Freshservice records, created a service catalog item, and modified S3 workflow configs — all without asking once. The user's `approval_mode` was `plan_first`. The model rationalized past every gate because it "had momentum." That is exactly the failure mode this section prevents.
1430
-
1431
- #### What requires approval (STOP before each one)
1432
-
1433
- Every individual external mutation needs its own approval. "The user approved the plan" does not mean "the user approved every API call in the plan." Present what you're about to do, wait for "go" / "yes" / "approved", then execute that one action.
1434
-
1435
- - **Okta**: creating apps, groups, assigning users, modifying policies
1436
- - **Freshservice**: creating tickets, records, catalog items, custom objects
1437
- - **Jira / Confluence**: creating or updating issues, pages, comments
1438
- - **Slack / Email**: sending messages (draft-before-send protocol applies)
1439
- - **Calendar**: creating or modifying events
1440
- - **S3 / cloud storage**: writing or modifying objects
1441
- - **Browser forms**: submitting data through playwright/puppeteer
1442
- - **Deploys**: any production-affecting operation
1443
- - **Git remote**: pushes, PR creation
1444
-
1445
- When multiple mutations are part of one plan, batch the approval request by phase — not one API call at a time (that would be annoying), but not "approve the whole plan and I'll do 15 things silently" either. Group related mutations:
1446
-
1447
- ```
1448
- Phase 1 ready — Okta setup:
1449
- - Create SAML app "Hindsight"
1450
- - Create groups: hindsight_admins, hindsight_users
1451
- - Add 3 users to hindsight_users
1452
-
1453
- Proceed with Phase 1? (yes/skip/modify)
1454
- ```
1455
-
1456
- Then after Phase 1 completes, present Phase 2 before executing it.
1457
-
1458
- #### What auto-proceeds (no approval needed)
1459
-
1460
- - local code edits, documentation updates
1461
- - tests, lint, builds, audits
1462
- - local git operations (branch, commit, inspection)
1463
- - reading from any MCP or API (GET requests)
1464
- - blackboard reads and writes
1465
- - saving drafts to `.ftm-drafts/`
1466
-
1467
- #### The momentum trap
1468
-
1469
- If you notice yourself thinking any of these, STOP — you are rationalizing past a gate:
1470
-
1471
- - "The user clearly wants this done, I'll just do it"
1472
- - "This is part of the approved plan"
1473
- - "I already started, might as well finish"
1474
- - "It's just one more API call"
1475
- - "The user will appreciate me being proactive"
1476
-
1477
- None of these override the gate. Present the action, wait for approval, then execute.
1478
-
1479
- If the user has explicitly requested stricter gates, honor that preference. If authentication or permission is missing, ask instead of guessing.
1480
-
1481
- ### 10. Ask-the-User Heuristic
1482
-
1483
- Ask the user only when one of these is true:
1484
-
1485
- - two materially different interpretations are both plausible
1486
- - an external-facing action needs approval
1487
- - a required credential, path, or identifier is missing
1488
- - the user explicitly asked for options before action
1489
- - **the task is medium+ and involves external systems, stakeholder coordination, or unfamiliar code** (see Discovery Interview below)
1490
-
1491
- When asking, ask one focused question with concrete choices.
1492
-
1493
- Good:
1494
-
1495
- - "Do you want me to treat this as a bug fix or a refactor?"
1496
- - "I can draft the Slack message or send it. Which do you want?"
1497
-
1498
- Bad:
1499
-
1500
- - "What do you want to do?"
1501
-
1502
- #### Discovery Interview (medium+ tasks with external systems)
1503
-
1504
- When a task hits forced-medium or higher AND involves external systems, stakeholder coordination, or code you haven't read yet this session, run a brief discovery interview BEFORE generating the plan. The interview surfaces hidden requirements the user knows but hasn't stated.
1505
-
1506
- The interview should be 2-4 focused questions, not open-ended. Ask about things you cannot determine from the codebase alone:
1507
-
1508
- - Who else needs to know about this change?
1509
- - Are there downstream systems or automations that depend on what's changing?
1510
- - Is there a timeline or dependency on someone else's approval?
1511
- - Should we also draft a message to anyone about this?
1512
- - Are there parts of this you want left alone for now vs. changed?
1513
-
1514
- Present the questions as a numbered list so the user can answer efficiently:
1515
-
1516
- ```
1517
- Before I plan this out, a few quick questions:
1518
-
1519
- 1. Who else needs to know about this change? (Slack message, email, etc.)
1520
- 2. Are there downstream systems that depend on [thing being changed]?
1521
- 3. Anything you want left as-is for now that I should avoid touching?
1522
- ```
1523
-
1524
- Then incorporate their answers into the plan. This takes 30 seconds and prevents the "oh wait, we also needed to do X" moment that comes after 5 minutes of grinding.
1525
-
1526
- **When to skip the interview:**
1527
- - The user already provided comprehensive context (e.g., pasted a Slack thread with full background)
1528
- - The task is purely local with no external dependencies
1529
- - The user explicitly says "just do it" or "no questions, go"
1530
-
1531
- ### 11. Orient Synthesis
1532
-
1533
- Before leaving Orient, silently synthesize all signals into one internal picture:
1534
-
1535
- - current outcome the user wants
1536
- - current task type
1537
- - session continuity
1538
- - codebase constraints
1539
- - relevant lessons
1540
- - relevant patterns
1541
- - capability mix
1542
- - smallest correct task size
1543
- - whether approval or clarification is needed
1544
-
1545
- Orient is complete only when the next move feels obvious.
1546
-
1547
- ## Decide
1548
-
1549
- Decide turns the orientation model into one concrete next move.
1550
-
1551
- ### 1. Choose the smallest correct execution mode
1552
-
1553
- - `micro` -> direct action
1554
- - `small` -> pre-flight summary, then direct action plus verification
1555
- - `medium` -> numbered plan, wait for approval, then execute
1556
- - `large` -> `ftm-brainstorm` if no plan exists, or `ftm-executor` if a plan exists
1557
-
1558
- **Double-check before committing to a size**: Re-read the forced escalation signals from the Complexity Sizing section. If any forced-medium signals fired, the task is medium regardless of how it feels. Do not rationalize past this — "it's basically just find-and-replace" is exactly how the Jira rerouting task looked before it turned into 15 edits across a 1700-line file plus stakeholder coordination plus a Slack draft. Present the plan.
1559
-
1560
- ### 1.5 Interactive Plan Approval
1561
-
1562
- Read `~/.claude/ftm-config.yml` field `execution.approval_mode`. This controls whether the user sees and approves the plan before execution begins.
1563
-
1564
- #### Mode: `auto` (default legacy behavior)
1565
- Skip this section entirely. Execute as before — micro/small just go, medium outlines steps and executes, large routes to brainstorm/executor.
1566
-
1567
- #### Mode: `plan_first` (recommended for collaborative work)
1568
-
1569
- **For small tasks**: Show a brief pre-flight summary before executing. This is not a formal approval gate — just visibility so the user knows what's about to happen. Present it inline and proceed unless the user objects:
1570
-
1571
- ```
1572
- Quick summary before I start:
1573
- - Read [file] to understand current behavior
1574
- - Change [X] to [Y] in [file]
1575
- - Verify: [test/lint/manual check]
1576
-
1577
- Going ahead unless you say otherwise.
1578
- ```
1579
-
1580
- **For medium and large tasks**: Present a numbered task list and wait for the user to approve before executing anything. Do NOT start executing while presenting the plan — the plan IS the first deliverable.
1581
-
1582
- **Step 0: Discovery Interview (if applicable).**
1583
-
1584
- Before generating the plan, check whether a Discovery Interview is needed (see Orient section 10). If the task involves external systems, stakeholder coordination, or unfamiliar code, run the interview FIRST. The user's answers feed directly into the plan — without them, the plan will miss requirements.
1585
-
1586
- The sequence is: Orient → Discovery Interview → Generate Plan → User Approval → Execute. Not: Orient → Generate Plan → Execute → "oh wait, we also needed to..."
1587
-
1588
- **Step 1: Generate the plan.**
1589
-
1590
- Build a numbered list of concrete steps based on Orient synthesis AND discovery interview answers. Each step must have:
1591
- - A number
1592
- - A one-line description of what will be done
1593
- - The files that will be touched
1594
- - The verification method (test, lint, visual check, or "self-evident")
1595
-
1596
- Present it like this:
1597
-
1598
- ```
1599
- Here's my plan for this task:
1600
-
1601
- 1. [ ] Read auth middleware and map dependencies → src/middleware/auth.ts
1602
- 2. [ ] Add OAuth token validation endpoint → src/routes/auth.ts, src/middleware/oauth.ts
1603
- 3. [ ] Update existing auth tests for new flow → src/__tests__/auth.test.ts
1604
- 4. [ ] Run full test suite → verify: pytest / npm test
1605
- 5. [ ] Update INTENT.md for changed functions → docs/INTENT.md
1606
-
1607
- Approve all? Or tell me what to change.
1608
- - "approve" or "go" → execute all steps in order
1609
- - "skip 3" → execute all except step 3
1610
- - "for step 2, use passport.js instead" → modify step 2, then execute all
1611
- - "only 1,2" → execute only steps 1 and 2
1612
- - "add: step between 2 and 3 to update the config" → insert a step
1613
- - "deny" or "stop" → cancel entirely
1614
- ```
1615
-
1616
- **Step 2: Parse the user's response.**
1617
-
1618
- | User says | Action |
1619
- |-----------|--------|
1620
- | `approve`, `go`, `yes`, `lgtm`, `ship it` | Execute all steps in order |
1621
- | `skip N` or `skip N,M` | Remove those steps, execute the rest |
1622
- | `only N,M,P` | Execute only the listed steps in order |
1623
- | `for step N, [instruction]` | Replace step N's approach with the user's instruction, then execute all |
1624
- | `add: [description] after N` or `add: [description] before N` | Insert a new step at that position, renumber, then execute all |
1625
- | `deny`, `stop`, `cancel`, `no` | Cancel. Do not execute anything. Ask what the user wants instead. |
1626
- | A longer message with mixed feedback | Parse each instruction. Apply all modifications to the plan. Present the revised plan and ask for final approval. |
1627
-
1628
- **Step 3: Execute the approved plan.**
1629
-
1630
- Work through the approved steps sequentially. After each step:
1631
- - Show a brief completion message: `Step 2/5 done: OAuth endpoint added.`
1632
- - If a step fails, stop and report. Ask: "Step 3 failed: [error]. Fix and continue, skip this step, or stop?"
1633
- - After all steps complete, show a summary of what was done.
1634
-
1635
- **Step 4: Post-execution update.**
1636
-
1637
- Update the blackboard with decisions made and experience recorded, same as normal Act phase.
1638
-
1639
- #### Mode: `always_ask`
1640
- Same as `plan_first` but applies to **small** tasks too. Only micro tasks (single obvious edit) skip the approval gate.
1641
-
1642
- #### Combining with explicit skill routing
1643
-
1644
- When the mind decides to route to a skill (e.g., ftm-debug, ftm-executor), the plan approval still applies if the mode is `plan_first` or `always_ask`. Present:
1645
-
1646
- ```
1647
- For this task, I'd route to ftm-debug with this approach:
1648
-
1649
- 1. [ ] Launch ftm-debug war room on the flaky auth test
1650
- 2. [ ] Apply the fix from debug findings
1651
- 3. [ ] Run test suite to verify
1652
- 4. [ ] Record experience to blackboard
1653
-
1654
- Approve? Or adjust the approach.
1655
- ```
1656
-
1657
- This gives the user control over the *strategy* even when delegating to skills.
1658
-
1659
- ### 2. Choose direct vs routed execution
1660
-
1661
- Use direct execution when:
1662
-
1663
- - the work is micro or small
1664
- - routing overhead adds no value
1665
- - the answer can be delivered faster than a delegated workflow
1666
-
1667
- Use a ftm skill when:
1668
-
1669
- - its specialized workflow will materially improve the result
1670
- - the user explicitly invoked it
1671
- - the task is medium/large and the skill is the right vehicle
1672
-
1673
- ### 3. Choose any supporting MCP reads
1674
-
1675
- If the request depends on external context, fetch the minimum required state first.
1676
-
1677
- Examples:
1678
-
1679
- - Jira URL -> read the ticket first
1680
- - meeting request -> read calendar first
1681
- - internal policy question -> search Glean first
1682
- - UI bug -> snapshot or inspect browser first
1683
-
1684
- ### 4. Decide whether to loop
1685
-
1686
- If the next move will reveal new information, plan to re-enter Observe after the action. This is normal for debugging, investigation, and mixed-tool workflows.
1687
-
1688
- ## Act
1689
-
1690
- Act is clean, decisive execution — but execution of **approved** work only.
1691
-
1692
- **Pre-Act checkpoint**: Before executing anything, verify:
1693
-
1694
- 1. If `approval_mode` is `plan_first` or `always_ask`, did the user explicitly approve the plan? (Words like "go", "yes", "approved", "do it", "ship it" — not silence, not your own narration of the plan.)
1695
- 2. If the task involves external mutations (see Approval Gates section 9), have you presented the specific actions and received approval?
1696
- 3. If neither condition applies, proceed.
1697
-
1698
- If you cannot point to a specific user message that approved the plan, you have not received approval. Go back to Decide and present the plan.
1699
-
1700
- ### 1. Direct action
1701
-
1702
- For micro tasks:
1703
-
1704
- - do the work
1705
- - summarize what changed
1706
-
1707
- For small tasks (when `approval_mode` is `plan_first` or `always_ask`):
1708
-
1709
- - show the pre-flight summary first (see Decide section 1.5)
1710
- - then do the work
1711
- - verify
1712
- - summarize what changed
1713
-
1714
- The pre-flight summary is not a gate — you proceed immediately after showing it unless the user objects. But showing it is mandatory because it gives the user a chance to catch mis-sizing or redirect before work begins. If the user says "wait" or "actually..." after seeing the pre-flight, stop and listen.
1715
-
1716
- Do not over-narrate during execution.
1717
-
1718
- ### 2. Skill routing
1719
-
1720
- Before invoking a skill, show one short routing line.
1721
-
1722
- Examples:
1723
-
1724
- - `Routing to ftm-debug: this is a flaky failure with real diagnostic uncertainty.`
1725
- - `Routing to ftm-brainstorm: this is still design-stage and benefits from research-backed planning.`
1726
-
1727
- Then invoke the target skill with the full user input.
1728
-
1729
- ### 3. MCP execution
1730
-
1731
- Use:
1732
-
1733
- - parallel reads when safe
1734
- - sequential writes
1735
- - approval gates only for external-facing actions
1736
-
1737
- ### 3.5. Draft-before-send protocol
1738
-
1739
- When composing Slack messages, emails, or any outbound communication, always save the draft locally before sending.
1740
-
1741
- **Drafts folder**: `.ftm-drafts/` in the project root (or `~/.claude/ftm-drafts/` if no project context).
1742
-
1743
- **Ensure the folder exists and is gitignored:**
1744
-
1745
- 1. Create `.ftm-drafts/` if it doesn't exist
1746
- 2. Check `.gitignore` — if `.ftm-drafts/` is not listed, add it
1747
-
1748
- **Save every draft** before presenting it to the user or sending it:
1749
-
1750
- - Filename: `YYYY-MM-DD_HH-MM_<type>_<recipient-or-channel>.md` (e.g., `2026-03-19_14-30_slack_mo-ali.md`)
1751
- - Content format:
1752
- ```markdown
1753
- ---
1754
- type: slack | email
1755
- to: #channel-name | @person | email@address
1756
- subject: (email only)
1757
- drafted: 2026-03-19T14:30:00
1758
- status: draft | sent | cancelled
1759
- ---
1760
-
1761
- [message body]
1762
- ```
1763
-
1764
- **Workflow:**
1765
- 1. Compose the message
1766
- 2. Save to `.ftm-drafts/`
1767
- 3. Present to user for approval (this is already required by the approval gates)
1768
- 4. If approved and sent, update `status: sent` in the file
1769
- 5. If cancelled or modified, update accordingly
1770
-
1771
- This gives the user a local audit trail of everything ftm drafted on their behalf, without polluting git history.
1772
-
1773
- ### 4. Blackboard updates (mandatory)
1774
-
1775
- After every completed task — not just "meaningful" ones — update the blackboard. This is how ftm learns. If you skip this step, the next session starts from zero on tasks like this one.
1776
-
1777
- **Always do all of these:**
1778
-
1779
- 1. Update `context.json` — set `current_task` to reflect what was done, append to `recent_decisions`
1780
- 2. Update `session_metadata.skills_invoked` if a skill was used
1781
- 3. If environment discovery ran this session, ensure `capabilities.json` is written to `~/.claude/ftm-state/blackboard/capabilities.json` with the current snapshot (schema: `capabilities.schema.json` in the same directory)
1782
-
1783
- **After task completion, always record an experience file:**
1784
-
1785
- 3. Write an experience file to `~/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json`
1786
- 4. Update `~/.claude/ftm-state/blackboard/experiences/index.json` with the new entry
1787
-
1788
- The experience file should capture:
1789
- - `task_type`: what kind of work this was (e.g., `integration-reroute`, `automation-update`, `bug-fix`)
1790
- - `tags`: domain nouns for future retrieval (e.g., `jira`, `freshservice`, `llm-integration`, `aria`, `itwork2`)
1791
- - `outcome`: `success` or `partial` or `failed`
1792
- - `lessons`: what worked, what was missed, what to do differently next time
1793
- - `files_touched`: list of files modified
1794
- - `stakeholders`: people involved or notified
1795
- - `decisions_made`: key choices and their rationale
1796
-
1797
- The reason this is mandatory: the Jira rerouting task involved discovering that ARIA uses Stories not CRs, has no active sprints, needs different custom fields, and requires stakeholder coordination with Mo. None of that is in the code — it's tribal knowledge that only exists if we record it.
1798
-
1799
- Follow the schema and full-file write rules from `blackboard-schema.md`.
1800
-
1801
- ### 5. Loop
1802
-
1803
- After acting:
1804
-
1805
- - if complete, answer and stop
1806
- - if new information appeared, return to Observe
1807
- - if blocked by approval or missing info, ask the user
1808
- - if the simple approach failed, re-orient and escalate one level
1809
-
1810
- ## Routing Scenarios
1811
-
1812
- Use these as behavioral tests.
1813
-
1814
- | Input | What Orient notices | Decision |
1815
- |---|---|---|
1816
- | `debug this flaky test` | bug, uncertainty, likely multiple hypotheses | route to `ftm-debug` |
1817
- | `help me think through auth design` | ideation, architecture, not implementation yet | route to `ftm-brainstorm` |
1818
- | `execute ~/.claude/plans/foo.md` | explicit plan path and execution ask | route to `ftm-executor` |
1819
- | `rename this variable` | one obvious local edit, tiny blast radius | handle directly as `micro` |
1820
- | `what would other AIs think about this approach` | explicit multi-model request | route to `ftm-council` |
1821
- | `audit the wiring` | structural verification request | route to `ftm-audit` |
1822
- | Jira ticket URL only | ticket-driven work, intent not yet clear | fetch via `mcp-atlassian-personal`, then re-orient |
1823
- | `check my calendar and draft a slack message` | mixed-domain workflow, read + external draft/send boundary | read calendar, draft Slack, ask before send |
1824
- | `make this better` | ambiguous, insufficient anchor | ask one focused clarifying question |
1825
- | `/ftm help` | explicit help/menu request | show help menu |
1826
- | `I just committed the fix, now check it` | continuation, recent commit validation | inspect diff, run tests or audit, then report |
1827
- | `/ftm-debug auth race condition` | explicit skill choice | respect explicit route to `ftm-debug` |
1828
- | `/ftm-brainstorm replacement for Okta hooks` | explicit design-phase route | respect explicit route to `ftm-brainstorm` |
1829
- | `open the page and tell me what looks broken` | visual/browser task | route to `ftm-browse` or use browser support if already in-flow |
1830
- | `add error handling to the API routes` | medium task, multi-file, `plan_first` mode | present numbered plan for approval, wait for user response, then execute approved steps |
1831
- | `refactor auth to support OAuth` (with `plan_first`) | medium-large, multi-file with dependencies | present plan with 5-7 steps, user says "skip 4, for step 3 use passport.js" → adjust and execute |
1832
- | `reroute the Jira automation from ITWORK2 to ARIA` | forced-medium: external systems (Jira), cross-system references, unfamiliar codebase, stakeholder coordination | present numbered plan listing all reference changes, stakeholder communication, and verification steps — do NOT start editing code |
1833
- | `update the integration to point to the new API endpoint` | forced-medium: cross-system references, automation code, multiple files likely | present plan first — even if it looks like "just change a URL", the blast radius of integration changes is always higher than expected |
1834
-
1835
- ## Help Menu
1836
-
1837
- When the user asks for help, shows empty input, or says `?` or `menu`, show:
1838
-
1839
- ```text
1840
- Panda Skills:
1841
- /ftm brainstorm [idea] — Research-backed idea development
1842
- /ftm execute [plan-path] — Autonomous plan execution with agent teams
1843
- /ftm debug [description] — Multi-vector deep debugging war room
1844
- /ftm audit — Wiring verification
1845
- /ftm council [question] — Multi-model deliberation
1846
- /ftm intent — Manage INTENT.md documentation
1847
- /ftm diagram — Manage architecture diagrams
1848
- /ftm codex-gate — Run adversarial Codex validation
1849
- /ftm browse [url] — Visual verification with browser tools
1850
- /ftm pause — Save session state for later
1851
- /ftm resume — Resume a paused session
1852
- /ftm upgrade — Check for skill updates
1853
- /ftm retro — Post-execution retrospective
1854
- /ftm config — Configure ftm settings
1855
- /ftm git — Secret scanning & credential safety gate
1856
- /ftm mind [anything] — Full cognitive loop
1857
-
1858
- Or just describe what you need and ftm-mind will figure out the smallest correct next move.
1859
- ```
1860
-
1861
- ## Anti-Patterns
1862
-
1863
- Avoid these failures:
1864
-
1865
- - keyword routing without real orientation
1866
- - routing a micro task just because a matching skill exists
1867
- - asking broad open-ended clarifying questions when a focused one would do
1868
- - apologizing for empty memory on cold start
1869
- - using past experience to override present repo reality
1870
- - escalating to planning when a direct pass would work
1871
- - performing external-facing actions without approval
1872
- - ignoring explicit skill invocation when it is coherent and safe
1873
- - **downsizing past forced escalation boundaries** — if forced-medium signals fired, the task is medium. Period. "It's basically just find-and-replace" is the exact rationalization that leads to grinding through 15 edits without a plan.
1874
- - **starting to edit code before presenting a plan** when `approval_mode` is `plan_first` and the task is medium+. The plan IS the first deliverable. Reading code to inform the plan is fine. Editing code before plan approval is not.
1875
- - **treating unfamiliar codebases as simple** — if you haven't read the code yet this session, you don't know how complex the change is. Default to medium until you've oriented.
1876
- - **skipping the discovery interview** for medium+ tasks that involve external systems or stakeholders. "I have enough context from the request" is almost never true — the user always knows things they haven't said yet.
1877
- - **skipping blackboard writes** after task completion. If you don't record the experience, the next session starts from zero. Tribal knowledge about project-specific details (custom field IDs, board configurations, stakeholder preferences) is exactly what experiences are for.
1878
-
1879
- ## Operating Principles
1880
-
1881
- 1. Orient is the differentiator. Without it, this is just a router.
1882
- 2. Try simple first. Escalate only when reality demands it.
1883
- 3. Respect explicit user intent.
1884
- 4. Cold start is full capability, not degraded mode.
1885
- 5. Experience retrieval must be concrete and selective.
1886
- 6. Read before write.
1887
- 7. Session trajectory matters.
1888
- 8. The best route is often no route at all.
1889
-
1890
- ## Requirements
1891
-
1892
- - tool: `git` | required | codebase state inspection (git status, git log)
1893
- - config: `~/.claude/ftm-config.yml` | optional | approval_mode, execution preferences
1894
- - reference: `~/.claude/skills/ftm-mind/references/mcp-inventory.md` | required | MCP capability routing table
1895
- - reference: `~/.claude/ftm-state/blackboard/context.json` | optional | session state and preferences
1896
- - reference: `~/.claude/ftm-state/blackboard/experiences/index.json` | optional | experience retrieval index
1897
- - reference: `~/.claude/ftm-state/blackboard/patterns.json` | optional | promoted patterns for orientation
1898
-
1899
- ## Risk
1900
-
1901
- - level: low_write
1902
- - scope: writes blackboard context and experience files; local code edits only on micro/small direct tasks; routes to other skills for larger work
1903
- - rollback: blackboard writes can be reverted by editing JSON files; no destructive mutations performed directly
1904
-
1905
- ## Approval Gates
1906
-
1907
- - trigger: task_size >= medium AND involves external systems | action: present numbered plan and wait for explicit user approval
1908
- - trigger: any external mutation (Okta, Freshservice, Jira, Slack, email, calendar, S3, deploys, git push) | action: present phase-level approval request before executing each mutation
1909
- - trigger: task_size == small AND approval_mode == always_ask | action: show pre-flight summary before proceeding
1910
- - complexity_routing: micro → auto | small → auto (pre-flight summary if plan_first) | medium → plan_first | large → plan_first | xl → always_ask
1911
-
1912
- ## Fallbacks
1913
-
1914
- - condition: blackboard context.json missing or malformed | action: treat as empty state, proceed at full capability using live observation
1915
- - condition: experiences/index.json empty or no matching entries | action: skip experience retrieval, lean on current repo state and direct inspection
1916
- - condition: patterns.json missing | action: skip pattern application, rely on direct analysis
1917
- - condition: ftm-config.yml missing | action: default to plan_first approval_mode and balanced model profile
1918
- - condition: mcp-inventory.md missing | action: rely on built-in MCP routing heuristics from skill body
1919
- - condition: requested ftm skill unavailable | action: notify user and attempt direct handling or alternate routing
1920
-
1921
- ## Capabilities
1922
-
1923
- - mcp: `git` | optional | codebase state, diffs, history, commits
1924
- - mcp: `mcp-atlassian-personal` | optional | Jira/Confluence reads for ticket-driven work
1925
- - mcp: `slack` | optional | Slack context reads, draft messages
1926
- - mcp: `gmail` | optional | email reads, drafts
1927
- - mcp: `google-calendar` | optional | calendar inspection for scheduling requests
1928
- - mcp: `freshservice-mcp` | optional | IT ticketing reads
1929
- - mcp: `sequential-thinking` | optional | multi-step reflective reasoning
1930
- - mcp: `playwright` | optional | browser automation for visual tasks
1931
- - mcp: `glean_default` | optional | internal company knowledge search
1932
- - mcp: `context7` | optional | external library documentation
1933
- - env: none required
1934
-
1935
- ## Event Payloads
1936
-
1937
- ### task_completed
1938
- - skill: string — "ftm-mind"
1939
- - task_type: string — detected task type (feature, bug, refactor, investigation, etc.)
1940
- - task_size: string — micro | small | medium | large
1941
- - route: string — direct | skill name routed to
1942
- - duration_ms: number — time from observe to act completion
1943
- - blackboard_updated: boolean — whether context.json and experience were written
1
+ ---
2
+ name: ftm-mind
3
+ description: Unified OODA cognitive loop for the ftm system. Use for freeform `/ftm` or `/ftm-mind` requests, vague asks, mixed-tool workflows, Jira/ticket-driven work, or any request that should be understood before routing. Also handles explicit ftm skill invocations by honoring the requested skill while still doing a fast orientation pass for context, prerequisites, and approval gates. Triggers on open-ended requests like "help me think through this", bug reports, plan execution asks, Jira URLs, "make this better", mixed MCP asks like "check my calendar and draft a Slack message", and direct skill invocations like "/ftm-debug ..." or "/ftm-brainstorm ...". Do NOT use only when another ftm skill is already actively handling the task and no re-orientation is needed.
4
+ ---
5
+
6
+ # FTM Mind
7
+
8
+ `ftm-mind` is the reasoning core of the ftm ecosystem. It does not route by keyword alone. It observes the request, orients against live state and accumulated memory, decides the smallest correct next move, acts, then loops.
9
+
10
+ The loop is:
11
+
12
+ `Observe -> Orient -> Decide -> Act -> Observe`
13
+
14
+ Most requests finish in one pass. Harder requests loop several times.
15
+
16
+ ## Entry Modes
17
+
18
+ ### Mode 1: Freeform
19
+
20
+ The user says `/ftm ...`, `/ftm-mind ...`, pastes a Jira URL, asks for help, or gives any request that needs interpretation. Run the full loop.
21
+
22
+ ### Mode 2: Explicit skill invocation
23
+
24
+ The user says `/ftm-debug ...`, `/ftm-brainstorm ...`, `/ftm-audit`, or otherwise clearly names a ftm skill.
25
+
26
+ When this happens:
27
+
28
+ 1. Respect the explicit choice as the default route.
29
+ 2. Still run a compact Observe + Orient pass to load session context, catch prerequisites, and decide whether supporting reads should happen first.
30
+ 3. Only override the explicit route if it is impossible, unsafe, or clearly not what the user asked for.
31
+
32
+ ## Observe
33
+
34
+ Observe is fast and literal. Do not solve yet. Just collect the raw state.
35
+
36
+ ### 1. Capture the request exactly
37
+
38
+ Preserve: the full user text, any explicit skill names, file paths, URLs, ticket IDs, error messages, stack traces, branch names, time signals, and whether the user sounds blocked, exploratory, urgent, or mid-flight.
39
+
40
+ ### 2. Detect the task shape
41
+
42
+ Note but do not finalize: likely task type (`feature`, `bug`, `refactor`, `investigation`, `configuration`, `documentation`, `test`, `deploy`, `communication`, `research`, `ops`, `multi`), likely scope (`answer`, `edit`, `workflow`, `orchestration`), and whether this continues the current session or branches.
43
+
44
+ ### 2.5. Personality Loading
45
+
46
+ On first invocation per session, read `references/personality.md` for personality context, profile DO/DON'T rules, and Atlassian MCP account routing.
47
+
48
+ ### 3. Load active session state
49
+
50
+ Read `~/.claude/ftm-state/blackboard/context.json`. Extract: `current_task`, `recent_decisions`, `active_constraints`, `user_preferences`, `session_metadata.skills_invoked`. If missing or malformed, treat as empty state.
51
+
52
+ ### 4. Snapshot codebase reality
53
+
54
+ Run `git status --short` and `git log --oneline -5`. Note: uncommitted changes, recent commits, current branch, whether the worktree is clean.
55
+
56
+ ## Orient
57
+
58
+ Orient is the crown jewel. Spend most of the reasoning budget here. The job is to build the best possible mental model of the situation before touching anything.
59
+
60
+ Orient answers: `What is actually going on, what matters most, what is the smallest correct move, and what capability mix fits this situation?`
61
+
62
+ ### Orient Priority Order
63
+
64
+ Work through these in order. Each sub-step builds on the previous.
65
+
66
+ ### 1. Request Geometry
67
+
68
+ Parse the request for:
69
+
70
+ - verbs: build, fix, debug, help, explain, audit, plan, research, check, draft, send, deploy
71
+ - objects: a file, a bug, a system, a concept, a ticket, a Slack thread, a meeting
72
+ - modifiers: quickly, thoroughly, carefully, just, also, before
73
+ - scope boundaries: one file, one module, the whole app, multiple repos
74
+
75
+ Request geometry determines how many concerns are in play and where the boundaries are.
76
+
77
+ ### 1.5. Environment Discovery
78
+
79
+ `Read references/environment-discovery.md` Probes MCP servers, CLI tools, and env vars on first request per session. Caches results for 15 minutes. Affects plan feasibility checking.
80
+
81
+ ### 2. Blackboard Loading
82
+
83
+ `Read references/blackboard-protocol.md` — Loads context.json, experiences, and patterns. Handles cold-start gracefully.
84
+
85
+ ### 3. Capability Inventory + MCP Inventory
86
+
87
+ `Read references/orient-protocol.md` Full skill table (16 ftm skills including ftm-ops), MCP server table, matching heuristics, multi-MCP chaining rules, session trajectory analysis, codebase state assessment, approval gates, ask-the-user heuristic, discovery interview protocol, and orient synthesis.
88
+
89
+ ### 4. Complexity Sizing
90
+
91
+ `Read references/complexity-sizing.md` Sizes the task as micro/small/medium/large from observed evidence. Includes forced escalation boundaries, the ADaPT rule, and the Hindsight incident as a cautionary reference.
92
+
93
+ ## Decide
94
+
95
+ `Read references/decide-act-protocol.md` for full Decide + Act details.
96
+
97
+ Decide turns the orientation model into one concrete next move:
98
+
99
+ 1. **Choose execution mode** micro (direct), small (pre-flight + direct), medium (plan + approve), large (brainstorm/executor)
100
+ 2. **Interactive Plan Approval** — respects `approval_mode` from ftm-config.yml
101
+ 3. **Choose direct vs routed** — route to a skill only when its workflow adds clear value
102
+ 4. **Choose supporting MCP reads** — fetch minimum required external state first
103
+ 5. **Decide whether to loop** — if the action will reveal new information, plan to re-enter Observe
104
+
105
+ ## Act
106
+
107
+ Act is clean, decisive execution — but execution of **approved** work only.
108
+
109
+ `Read references/decide-act-protocol.md` for full Act details including:
110
+ - Direct action protocol (micro and small tasks)
111
+ - Skill routing protocol
112
+ - MCP execution rules
113
+ - Draft-before-send protocol
114
+ - Blackboard updates (mandatory after every task)
115
+ - Loop behavior
116
+
117
+ For micro/small direct execution details: `Read references/direct-execution.md`
118
+
119
+ ## Routing Scenarios
120
+
121
+ Use these as behavioral tests.
122
+
123
+ | Input | What Orient notices | Decision |
124
+ |---|---|---|
125
+ | `debug this flaky test` | bug, uncertainty, multiple hypotheses | route to `ftm-debug` |
126
+ | `help me think through auth design` | ideation, architecture | route to `ftm-brainstorm` |
127
+ | `execute ~/.claude/plans/foo.md` | explicit plan path | route to `ftm-executor` |
128
+ | `rename this variable` | one obvious local edit | handle directly as `micro` |
129
+ | `what would other AIs think` | multi-model request | route to `ftm-council` |
130
+ | `audit the wiring` | structural verification | route to `ftm-audit` |
131
+ | Jira ticket URL only | ticket-driven, intent unclear | fetch via `mcp-atlassian-personal` (configured name), re-orient |
132
+ | `check my calendar and draft a slack message` | mixed-domain | read calendar, draft Slack, ask before send |
133
+ | `make this better` | ambiguous | ask one focused clarifying question |
134
+ | `what's blocking me?` | ops/task request | route to `ftm-ops` |
135
+ | `am I overcommitted?` | capacity/burnout check | route to `ftm-ops` |
136
+ | `wrap up` / `what happened today` | daily narrative | route to `ftm-ops` |
137
+ | `/ftm-debug auth race condition` | explicit skill choice | respect explicit route to `ftm-debug` |
138
+ | `add error handling to the API routes` | medium task, `plan_first` | present numbered plan, wait for approval |
139
+ | `reroute the Jira automation` | forced-medium: external systems | present plan — do NOT start editing code |
140
+
141
+ ## Help Menu
142
+
143
+ When the user asks for help, shows empty input, or says `?` or `menu`, show:
144
+
145
+ ```text
146
+ Panda Skills:
147
+ /ftm mind [anything] — Full cognitive loop
148
+ /ftm ops [request] — Task management, capacity, stakeholders, meetings
149
+ /ftm brainstorm [idea] — Research-backed idea development
150
+ /ftm execute [plan-path] — Autonomous plan execution with agent teams
151
+ /ftm debug [description] — Multi-vector deep debugging war room
152
+ /ftm audit Wiring verification
153
+ /ftm council [question] — Multi-model deliberation
154
+ /ftm intent — Manage INTENT.md documentation
155
+ /ftm diagram — Manage architecture diagrams
156
+ /ftm codex-gate — Run adversarial Codex validation
157
+ /ftm browse [url] — Visual verification with browser tools
158
+ /ftm pause — Save session state for later
159
+ /ftm resume — Resume a paused session
160
+ /ftm upgrade — Check for skill updates
161
+ /ftm retro — Post-execution retrospective
162
+ /ftm config — Configure ftm settings
163
+ /ftm git — Secret scanning & credential safety gate
164
+ /ftm capture — Save workflow as reusable routine
165
+
166
+ Or just describe what you need and ftm-mind will figure out the smallest correct next move.
167
+ ```
168
+
169
+ ## Anti-Patterns
170
+
171
+ Avoid these failures:
172
+
173
+ - keyword routing without real orientation
174
+ - routing a micro task just because a matching skill exists
175
+ - asking broad open-ended clarifying questions when a focused one would do
176
+ - apologizing for empty memory on cold start
177
+ - using past experience to override present repo reality
178
+ - escalating to planning when a direct pass would work
179
+ - performing external-facing actions without approval
180
+ - ignoring explicit skill invocation when it is coherent and safe
181
+ - **downsizing past forced escalation boundaries** — if forced-medium signals fired, the task is medium. Period.
182
+ - **starting to edit code before presenting a plan** when `approval_mode` is `plan_first` and the task is medium+
183
+ - **treating unfamiliar codebases as simple** default to medium until oriented
184
+ - **skipping the discovery interview** for medium+ tasks with external systems
185
+ - **skipping blackboard writes** after task completion
186
+
187
+ ## Operating Principles
188
+
189
+ 1. Orient is the differentiator. Without it, this is just a router.
190
+ 2. Try simple first. Escalate only when reality demands it.
191
+ 3. Respect explicit user intent.
192
+ 4. Cold start is full capability, not degraded mode.
193
+ 5. Experience retrieval must be concrete and selective.
194
+ 6. Read before write.
195
+ 7. Session trajectory matters.
196
+ 8. The best route is often no route at all.
197
+
198
+ ## Fallbacks
199
+
200
+ - If a required capability is missing, use the skill's fallback from its manifest.
201
+ - If no fallback exists, warn the user: "Plan step N requires [capability] which is not available. Skip or find alternative?"