feed-the-machine 1.3.0 → 1.3.1

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.
package/ftm-mind/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: ftm-mind
3
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
4
  ---
5
5
 
6
- # Panda Mind
6
+ # FTM Mind
7
7
 
8
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
9
 
@@ -62,7 +62,7 @@ At Observe time, note but do not finalize:
62
62
 
63
63
  Read:
64
64
 
65
- - `/Users/kioja.kudumu/.claude/ftm-state/blackboard/context.json`
65
+ - `~/.claude/ftm-state/blackboard/context.json`
66
66
 
67
67
  Extract:
68
68
 
@@ -199,9 +199,9 @@ Read the blackboard in this order:
199
199
 
200
200
  Use these exact paths:
201
201
 
202
- - `/Users/kioja.kudumu/.claude/ftm-state/blackboard/context.json`
203
- - `/Users/kioja.kudumu/.claude/ftm-state/blackboard/experiences/index.json`
204
- - `/Users/kioja.kudumu/.claude/ftm-state/blackboard/patterns.json`
202
+ - `~/.claude/ftm-state/blackboard/context.json`
203
+ - `~/.claude/ftm-state/blackboard/experiences/index.json`
204
+ - `~/.claude/ftm-state/blackboard/patterns.json`
205
205
 
206
206
  #### 2.1 `context.json`
207
207
 
@@ -227,7 +227,7 @@ Experience retrieval must be concrete, not hand-wavy.
227
227
 
228
228
  Protocol:
229
229
 
230
- 1. Read `/Users/kioja.kudumu/.claude/ftm-state/blackboard/experiences/index.json`
230
+ 1. Read `~/.claude/ftm-state/blackboard/experiences/index.json`
231
231
  2. Parse `entries`
232
232
  3. Derive a current `task_type`
233
233
  4. Derive current tags from the request and codebase context
@@ -236,7 +236,7 @@ Protocol:
236
236
  - there is at least one overlapping tag
237
237
  6. Sort filtered entries by `recorded_at` descending
238
238
  7. Load the top 3-5 matching experience files from:
239
- - `/Users/kioja.kudumu/.claude/ftm-state/blackboard/experiences/{filename}`
239
+ - `~/.claude/ftm-state/blackboard/experiences/{filename}`
240
240
  8. Prefer lessons from entries with:
241
241
  - `outcome: success`
242
242
  - higher `confidence`
@@ -333,7 +333,7 @@ Routing heuristic:
333
333
 
334
334
  Read:
335
335
 
336
- - `/Users/kioja.kudumu/.claude/skills/ftm-mind/references/mcp-inventory.md`
336
+ - `~/.claude/skills/ftm-mind/references/mcp-inventory.md`
337
337
 
338
338
  Orient must know the available MCPs and their contextual triggers.
339
339
 
@@ -928,12 +928,862 @@ After every completed task — not just "meaningful" ones — update the blackbo
928
928
 
929
929
  1. Update `context.json` — set `current_task` to reflect what was done, append to `recent_decisions`
930
930
  2. Update `session_metadata.skills_invoked` if a skill was used
931
- 3. If environment discovery ran this session, ensure `capabilities.json` is written to `/Users/kioja.kudumu/.claude/ftm-state/blackboard/capabilities.json` with the current snapshot (schema: `capabilities.schema.json` in the same directory)
932
931
 
933
932
  **After task completion, always record an experience file:**
934
933
 
935
- 3. Write an experience file to `/Users/kioja.kudumu/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json`
936
- 4. Update `/Users/kioja.kudumu/.claude/ftm-state/blackboard/experiences/index.json` with the new entry
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
937
1787
 
938
1788
  The experience file should capture:
939
1789
  - `task_type`: what kind of work this was (e.g., `integration-reroute`, `automation-update`, `bug-fix`)