feed-the-machine 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +268 -0
- package/bin/generate-manifest.mjs +210 -0
- package/bin/install.mjs +114 -0
- package/ftm/SKILL.md +88 -0
- package/ftm-audit/SKILL.md +146 -0
- package/ftm-audit/references/protocols/PROJECT-PATTERNS.md +91 -0
- package/ftm-audit/references/protocols/RUNTIME-WIRING.md +66 -0
- package/ftm-audit/references/protocols/WIRING-CONTRACTS.md +135 -0
- package/ftm-audit/references/strategies/AUTO-FIX-STRATEGIES.md +69 -0
- package/ftm-audit/references/templates/REPORT-FORMAT.md +96 -0
- package/ftm-audit/scripts/run-knip.sh +23 -0
- package/ftm-audit.yml +2 -0
- package/ftm-brainstorm/SKILL.md +379 -0
- package/ftm-brainstorm/evals/evals.json +100 -0
- package/ftm-brainstorm/evals/promptfoo.yaml +109 -0
- package/ftm-brainstorm/references/agent-prompts.md +224 -0
- package/ftm-brainstorm/references/plan-template.md +121 -0
- package/ftm-brainstorm.yml +2 -0
- package/ftm-browse/SKILL.md +415 -0
- package/ftm-browse/daemon/browser-manager.ts +206 -0
- package/ftm-browse/daemon/bun.lock +30 -0
- package/ftm-browse/daemon/cli.ts +347 -0
- package/ftm-browse/daemon/commands.ts +410 -0
- package/ftm-browse/daemon/main.ts +357 -0
- package/ftm-browse/daemon/package.json +17 -0
- package/ftm-browse/daemon/server.ts +189 -0
- package/ftm-browse/daemon/snapshot.ts +519 -0
- package/ftm-browse/daemon/tsconfig.json +22 -0
- package/ftm-browse.yml +4 -0
- package/ftm-codex-gate/SKILL.md +302 -0
- package/ftm-codex-gate.yml +2 -0
- package/ftm-config/SKILL.md +310 -0
- package/ftm-config.default.yml +80 -0
- package/ftm-config.yml +2 -0
- package/ftm-council/SKILL.md +132 -0
- package/ftm-council/references/prompts/CLAUDE-INVESTIGATION.md +60 -0
- package/ftm-council/references/prompts/CODEX-INVESTIGATION.md +58 -0
- package/ftm-council/references/prompts/GEMINI-INVESTIGATION.md +58 -0
- package/ftm-council/references/prompts/REBUTTAL-TEMPLATE.md +57 -0
- package/ftm-council/references/protocols/PREREQUISITES.md +47 -0
- package/ftm-council/references/protocols/STEP-0-FRAMING.md +46 -0
- package/ftm-council.yml +2 -0
- package/ftm-dashboard.yml +4 -0
- package/ftm-debug/SKILL.md +146 -0
- package/ftm-debug/references/phases/PHASE-0-INTAKE.md +58 -0
- package/ftm-debug/references/phases/PHASE-1-TRIAGE.md +46 -0
- package/ftm-debug/references/phases/PHASE-2-WAR-ROOM-AGENTS.md +279 -0
- package/ftm-debug/references/phases/PHASE-3-TO-6-EXECUTION.md +436 -0
- package/ftm-debug/references/protocols/BLACKBOARD.md +86 -0
- package/ftm-debug/references/protocols/EDGE-CASES.md +103 -0
- package/ftm-debug.yml +2 -0
- package/ftm-diagram/SKILL.md +233 -0
- package/ftm-diagram.yml +2 -0
- package/ftm-executor/SKILL.md +657 -0
- package/ftm-executor/references/STYLE-TEMPLATE.md +73 -0
- package/ftm-executor/references/phases/PHASE-0-VERIFICATION.md +62 -0
- package/ftm-executor/references/phases/PHASE-2-AGENT-ASSEMBLY.md +34 -0
- package/ftm-executor/references/phases/PHASE-3-WORKTREES.md +38 -0
- package/ftm-executor/references/phases/PHASE-4-5-AUDIT.md +72 -0
- package/ftm-executor/references/phases/PHASE-4-DISPATCH.md +66 -0
- package/ftm-executor/references/phases/PHASE-5-5-CODEX-GATE.md +73 -0
- package/ftm-executor/references/protocols/DOCUMENTATION-BOOTSTRAP.md +36 -0
- package/ftm-executor/references/protocols/MODEL-PROFILE.md +44 -0
- package/ftm-executor/references/protocols/PROGRESS-TRACKING.md +66 -0
- package/ftm-executor/runtime/ftm-runtime.mjs +252 -0
- package/ftm-executor/runtime/package.json +8 -0
- package/ftm-executor.yml +2 -0
- package/ftm-git/SKILL.md +195 -0
- package/ftm-git/evals/evals.json +26 -0
- package/ftm-git/evals/promptfoo.yaml +75 -0
- package/ftm-git/hooks/post-commit-experience.sh +92 -0
- package/ftm-git/references/patterns/SECRET-PATTERNS.md +104 -0
- package/ftm-git/references/protocols/REMEDIATION.md +139 -0
- package/ftm-git/scripts/pre-commit-secrets.sh +110 -0
- package/ftm-git.yml +2 -0
- package/ftm-intent/SKILL.md +198 -0
- package/ftm-intent.yml +2 -0
- package/ftm-map.yml +2 -0
- package/ftm-mind/SKILL.md +986 -0
- package/ftm-mind/evals/promptfoo.yaml +142 -0
- package/ftm-mind/references/blackboard-schema.md +328 -0
- package/ftm-mind/references/complexity-guide.md +110 -0
- package/ftm-mind/references/event-registry.md +299 -0
- package/ftm-mind/references/mcp-inventory.md +296 -0
- package/ftm-mind/references/protocols/COMPLEXITY-SIZING.md +72 -0
- package/ftm-mind/references/protocols/MCP-HEURISTICS.md +32 -0
- package/ftm-mind/references/protocols/PLAN-APPROVAL.md +80 -0
- package/ftm-mind/references/reflexion-protocol.md +249 -0
- package/ftm-mind/references/routing/SCENARIOS.md +22 -0
- package/ftm-mind/references/routing-scenarios.md +35 -0
- package/ftm-mind.yml +2 -0
- package/ftm-pause/SKILL.md +133 -0
- package/ftm-pause/references/protocols/SKILL-RESTORE-PROTOCOLS.md +186 -0
- package/ftm-pause/references/protocols/VALIDATION.md +80 -0
- package/ftm-pause.yml +2 -0
- package/ftm-researcher.yml +2 -0
- package/ftm-resume/SKILL.md +166 -0
- package/ftm-resume/references/protocols/VALIDATION.md +172 -0
- package/ftm-resume.yml +2 -0
- package/ftm-retro/SKILL.md +189 -0
- package/ftm-retro/references/protocols/SCORING-RUBRICS.md +89 -0
- package/ftm-retro/references/templates/REPORT-FORMAT.md +109 -0
- package/ftm-retro.yml +2 -0
- package/ftm-routine.yml +4 -0
- package/ftm-state/blackboard/context.json +23 -0
- package/ftm-state/blackboard/experiences/index.json +9 -0
- package/ftm-state/blackboard/patterns.json +6 -0
- package/ftm-state/schemas/context.schema.json +130 -0
- package/ftm-state/schemas/experience-index.schema.json +77 -0
- package/ftm-state/schemas/experience.schema.json +78 -0
- package/ftm-state/schemas/patterns.schema.json +44 -0
- package/ftm-upgrade/SKILL.md +153 -0
- package/ftm-upgrade/scripts/check-version.sh +76 -0
- package/ftm-upgrade/scripts/upgrade.sh +143 -0
- package/ftm-upgrade.yml +2 -0
- package/ftm.yml +2 -0
- package/install.sh +102 -0
- package/package.json +74 -0
- package/uninstall.sh +25 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# MCP Matching Heuristics and Chaining
|
|
2
|
+
|
|
3
|
+
## Matching Rules
|
|
4
|
+
|
|
5
|
+
Use the smallest relevant MCP set.
|
|
6
|
+
|
|
7
|
+
- Jira issue key or Atlassian URL → `mcp-atlassian-personal`
|
|
8
|
+
- "internal docs", "runbook", "Klaviyo", "Glean" → `glean_default`
|
|
9
|
+
- "how do I use X library" → `context7`
|
|
10
|
+
- "calendar", "meeting", "free time" → `google-calendar`
|
|
11
|
+
- "Slack", "channel", "thread", "notify" → `slack`
|
|
12
|
+
- "email", "Gmail", "draft" → `gmail`
|
|
13
|
+
- "ticket", "hardware", "access request" → `freshservice-mcp`
|
|
14
|
+
- "browser", "screenshot", "look at the page" → `playwright`
|
|
15
|
+
- "profile performance in browser" → `chrome-devtools`
|
|
16
|
+
- "talk through trade-offs" → `sequential-thinking`
|
|
17
|
+
- "SwiftUI" or Apple framework names → `apple-doc-mcp`
|
|
18
|
+
- "find contact/company" → `lusha`
|
|
19
|
+
|
|
20
|
+
## Multi-MCP Chaining
|
|
21
|
+
|
|
22
|
+
Detect mixed-domain requests early.
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
- "check my calendar and draft a Slack message" → `google-calendar` + `slack`
|
|
26
|
+
- "read the Jira ticket, inspect the repo, then propose a fix" → `mcp-atlassian-personal` + `git`
|
|
27
|
+
- "search internal docs, then update a Confluence page" → `glean_default` + `mcp-atlassian-personal`
|
|
28
|
+
|
|
29
|
+
Rules:
|
|
30
|
+
- parallelize reads when safe
|
|
31
|
+
- gather state before proposing writes
|
|
32
|
+
- chain writes sequentially
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Interactive Plan Approval Protocol
|
|
2
|
+
|
|
3
|
+
Read `~/.claude/ftm-config.yml` field `execution.approval_mode`. This controls whether the user sees and approves the plan before execution begins.
|
|
4
|
+
|
|
5
|
+
## Mode: `auto` (default legacy behavior)
|
|
6
|
+
Skip this section entirely. Execute as before — micro/small just go, medium outlines steps and executes, large routes to brainstorm/executor.
|
|
7
|
+
|
|
8
|
+
## Mode: `plan_first` (recommended for collaborative work)
|
|
9
|
+
For **medium and large** tasks, present a numbered task list and wait for the user to approve before executing anything.
|
|
10
|
+
|
|
11
|
+
**Step 1: Generate the plan.**
|
|
12
|
+
|
|
13
|
+
Build a numbered list of concrete steps based on Orient synthesis. Each step must have:
|
|
14
|
+
- A number
|
|
15
|
+
- A one-line description of what will be done
|
|
16
|
+
- The files that will be touched
|
|
17
|
+
- The verification method (test, lint, visual check, or "self-evident")
|
|
18
|
+
|
|
19
|
+
Present it like this:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Here's my plan for this task:
|
|
23
|
+
|
|
24
|
+
1. [ ] Read auth middleware and map dependencies → src/middleware/auth.ts
|
|
25
|
+
2. [ ] Add OAuth token validation endpoint → src/routes/auth.ts, src/middleware/oauth.ts
|
|
26
|
+
3. [ ] Update existing auth tests for new flow → src/__tests__/auth.test.ts
|
|
27
|
+
4. [ ] Run full test suite → verify: pytest / npm test
|
|
28
|
+
5. [ ] Update INTENT.md for changed functions → docs/INTENT.md
|
|
29
|
+
|
|
30
|
+
Approve all? Or tell me what to change.
|
|
31
|
+
- "approve" or "go" → execute all steps in order
|
|
32
|
+
- "skip 3" → execute all except step 3
|
|
33
|
+
- "for step 2, use passport.js instead" → modify step 2, then execute all
|
|
34
|
+
- "only 1,2" → execute only steps 1 and 2
|
|
35
|
+
- "add: step between 2 and 3 to update the config" → insert a step
|
|
36
|
+
- "deny" or "stop" → cancel entirely
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Step 2: Parse the user's response.**
|
|
40
|
+
|
|
41
|
+
| User says | Action |
|
|
42
|
+
|-----------|--------|
|
|
43
|
+
| `approve`, `go`, `yes`, `lgtm`, `ship it` | Execute all steps in order |
|
|
44
|
+
| `skip N` or `skip N,M` | Remove those steps, execute the rest |
|
|
45
|
+
| `only N,M,P` | Execute only the listed steps in order |
|
|
46
|
+
| `for step N, [instruction]` | Replace step N's approach with the user's instruction, then execute all |
|
|
47
|
+
| `add: [description] after N` or `add: [description] before N` | Insert a new step at that position, renumber, then execute all |
|
|
48
|
+
| `deny`, `stop`, `cancel`, `no` | Cancel. Do not execute anything. Ask what the user wants instead. |
|
|
49
|
+
| A longer message with mixed feedback | Parse each instruction. Apply all modifications to the plan. Present the revised plan and ask for final approval. |
|
|
50
|
+
|
|
51
|
+
**Step 3: Execute the approved plan.**
|
|
52
|
+
|
|
53
|
+
Work through the approved steps sequentially. After each step:
|
|
54
|
+
- Show a brief completion message: `Step 2/5 done: OAuth endpoint added.`
|
|
55
|
+
- If a step fails, stop and report. Ask: "Step 3 failed: [error]. Fix and continue, skip this step, or stop?"
|
|
56
|
+
- After all steps complete, show a summary of what was done.
|
|
57
|
+
|
|
58
|
+
**Step 4: Post-execution update.**
|
|
59
|
+
|
|
60
|
+
Update the blackboard with decisions made and experience recorded, same as normal Act phase.
|
|
61
|
+
|
|
62
|
+
## Mode: `always_ask`
|
|
63
|
+
Same as `plan_first` but applies to **small** tasks too. Only micro tasks (single obvious edit) skip the approval gate.
|
|
64
|
+
|
|
65
|
+
## Combining with explicit skill routing
|
|
66
|
+
|
|
67
|
+
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:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
For this task, I'd route to ftm-debug with this approach:
|
|
71
|
+
|
|
72
|
+
1. [ ] Launch ftm-debug war room on the flaky auth test
|
|
73
|
+
2. [ ] Apply the fix from debug findings
|
|
74
|
+
3. [ ] Run test suite to verify
|
|
75
|
+
4. [ ] Record experience to blackboard
|
|
76
|
+
|
|
77
|
+
Approve? Or adjust the approach.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This gives the user control over the *strategy* even when delegating to skills.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Reflexion Protocol — Verbal RL for FTM-Mind
|
|
2
|
+
|
|
3
|
+
**Location**: `~/.claude/skills/ftm-mind/references/reflexion-protocol.md`
|
|
4
|
+
**Purpose**: Defines how ftm-mind stores and reuses execution experience through the Reflexion pattern — a lightweight verbal reinforcement learning loop that improves behavior across sessions without fine-tuning.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## The Reflexion Pattern
|
|
9
|
+
|
|
10
|
+
Reflexion is a simple feedback mechanism: after each significant action, write a short natural-language reflection describing what happened and why. Before the next attempt at a similar task, retrieve and prepend relevant reflections to the working context.
|
|
11
|
+
|
|
12
|
+
Core loop:
|
|
13
|
+
1. **Act** — execute the task using available skills and tools
|
|
14
|
+
2. **Reflect** — generate a structured verbal reflection on the outcome
|
|
15
|
+
3. **Store** — write the reflection as an experience entry to the blackboard
|
|
16
|
+
4. **Retrieve** — on the next similar task, load matching experiences during Orient
|
|
17
|
+
5. **Adjust** — synthesize retrieved lessons into an adjusted approach before acting
|
|
18
|
+
|
|
19
|
+
The key insight: language models do not update weights between conversations, but they can update behavior when prior experience is injected as context. Reflexion makes that injection systematic.
|
|
20
|
+
|
|
21
|
+
### What "Prepend to Next Attempt" Means
|
|
22
|
+
|
|
23
|
+
When ftm-mind enters the Orient phase of the OODA loop for a new task:
|
|
24
|
+
|
|
25
|
+
1. Read `experiences/index.json`
|
|
26
|
+
2. Filter entries matching the current `task_type` and any overlapping tags
|
|
27
|
+
3. Load the top 3–5 most recent matching experience files
|
|
28
|
+
4. Synthesize their `lessons` arrays into a short prior-experience summary
|
|
29
|
+
5. That summary is the first input considered when forming the plan — not an afterthought
|
|
30
|
+
|
|
31
|
+
This is the prepend. The retrieved experience shapes the approach before any analysis of the current task begins.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Trigger Conditions
|
|
36
|
+
|
|
37
|
+
Micro-reflections are written after any of the following events:
|
|
38
|
+
|
|
39
|
+
| Event | When It Fires | What to Record |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `task_completed` | Any task finishes — micro through large | Outcome, approach, what worked |
|
|
42
|
+
| `bug_fixed` | A bug was diagnosed and resolved | Root cause, fix strategy, what was misleading |
|
|
43
|
+
| `error_encountered` | An unexpected error during execution | Error context, what caused it, how to avoid |
|
|
44
|
+
| `code_committed` | A meaningful commit is made | What changed, why, any surprising side effects |
|
|
45
|
+
| `plan_generated` | A plan was created from brainstorming | Plan structure, assumptions made, expected risks |
|
|
46
|
+
| `user_correction` | The user corrected the mind's approach | What the mind got wrong, what the correct approach was |
|
|
47
|
+
|
|
48
|
+
Do not wait for a formal retro to record these. Write the experience file immediately after the triggering event resolves. Delayed recording produces lower-quality lessons.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Reflection Format
|
|
53
|
+
|
|
54
|
+
For each trigger, generate a structured verbal RL reflection before writing the experience entry:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
I [succeeded / failed / partially succeeded] at [task description] because [specific reason].
|
|
58
|
+
Next time I should [concrete, actionable adjustment].
|
|
59
|
+
Confidence: [low / medium / high]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Good Reflection Examples
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
I succeeded at adding the freshservice enrichment poller because the existing poller_runtime.py
|
|
66
|
+
pattern was reusable with minimal modification.
|
|
67
|
+
Next time I should check for existing runtime patterns before writing new polling infrastructure.
|
|
68
|
+
Confidence: medium
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
I partially succeeded at the Jira sync task because the field mapping worked but the
|
|
73
|
+
attachment handling failed silently — no error was surfaced until the next run.
|
|
74
|
+
Next time I should add explicit attachment count validation after every sync and log
|
|
75
|
+
mismatches immediately rather than relying on downstream detection.
|
|
76
|
+
Confidence: low
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
I failed at the database migration because I assumed the staging schema matched production
|
|
81
|
+
and did not read the migration history first.
|
|
82
|
+
Next time I should always read the last 5 migration files before writing a new one.
|
|
83
|
+
Confidence: high
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Bad Reflection Examples (Do Not Write These)
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
I did okay at the task. It was kind of complex.
|
|
90
|
+
Next time I should be more careful.
|
|
91
|
+
Confidence: medium
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Why bad: "be more careful" is not actionable. No specific reason for the outcome. Cannot be acted on by a future skill loading this file.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
I succeeded because I am good at code.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Why bad: No transferable lesson. Causation is not traced. Useless as a retrieval artifact.
|
|
101
|
+
|
|
102
|
+
### Decomposing Into Lessons
|
|
103
|
+
|
|
104
|
+
The verbal reflection maps to the `lessons` array in the experience entry. Decompose the "Next time I should..." clause into one or more concrete lesson strings:
|
|
105
|
+
|
|
106
|
+
Reflection: "Next time I should check for existing runtime patterns before writing new polling infrastructure and validate attachment handling with explicit count checks."
|
|
107
|
+
|
|
108
|
+
Lessons array:
|
|
109
|
+
```json
|
|
110
|
+
[
|
|
111
|
+
"Check for existing runtime patterns (e.g. poller_runtime.py) before writing new polling infrastructure from scratch.",
|
|
112
|
+
"Add explicit attachment count validation after every sync operation; do not rely on downstream error detection."
|
|
113
|
+
]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Experience Entry Format Reference
|
|
119
|
+
|
|
120
|
+
Full schema defined in `blackboard-schema.md`. Key fields for micro-reflections:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"task_type": "bug | feature | refactor | investigation | configuration | documentation | test | deploy",
|
|
125
|
+
"description": "1-2 sentence summary of what was attempted",
|
|
126
|
+
"approach": "How the task was approached — tools, strategies, sequence of steps",
|
|
127
|
+
"outcome": "success | partial | failure",
|
|
128
|
+
"lessons": [
|
|
129
|
+
"Concrete, actionable takeaway derived from the verbal RL reflection",
|
|
130
|
+
"Each lesson string must be specific enough to act on without further context"
|
|
131
|
+
],
|
|
132
|
+
"complexity_estimated": "trivial | low | medium | high | very_high",
|
|
133
|
+
"complexity_actual": "trivial | low | medium | high | very_high",
|
|
134
|
+
"capabilities_used": ["ftm-executor", "mcp__mcp-atlassian-personal__jira_get_issue", "backend-architect"],
|
|
135
|
+
"tags": ["python", "slack", "database", "auth"],
|
|
136
|
+
"confidence": "low | medium | high",
|
|
137
|
+
"recorded_at": "ISO8601 timestamp"
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Written to: `~/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json`
|
|
142
|
+
|
|
143
|
+
After writing the file, append a metadata entry to `experiences/index.json` and increment `total_count`.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Pattern Promotion Thresholds
|
|
148
|
+
|
|
149
|
+
Patterns are promoted from individual experience files into `patterns.json` when the same lesson has been independently observed enough times to be considered reliable.
|
|
150
|
+
|
|
151
|
+
| Occurrences | Action | Confidence Level |
|
|
152
|
+
|---|---|---|
|
|
153
|
+
| 1–2 | Stay in experience files only | — |
|
|
154
|
+
| 3 | Promote to `patterns.json` | `low` |
|
|
155
|
+
| 5+ | Raise confidence | `medium` |
|
|
156
|
+
| 8+ | Raise confidence | `high` |
|
|
157
|
+
|
|
158
|
+
### How to Detect Promotion Candidates
|
|
159
|
+
|
|
160
|
+
After writing an experience entry:
|
|
161
|
+
|
|
162
|
+
1. Read `experiences/index.json`
|
|
163
|
+
2. Find all entries where `task_type` matches AND at least one `tag` overlaps with the new entry
|
|
164
|
+
3. Load those experience files
|
|
165
|
+
4. Compare `lessons` arrays across all loaded files — look for thematic overlap (same root cause, same fix pattern, same constraint)
|
|
166
|
+
5. If 3+ entries share a lesson theme, the theme is ready to be promoted
|
|
167
|
+
|
|
168
|
+
Promotion writes to the appropriate category in `patterns.json`:
|
|
169
|
+
- `codebase_insights` — observations about the codebase structure, conventions, or tech choices
|
|
170
|
+
- `execution_patterns` — what approaches work or fail for specific task types
|
|
171
|
+
- `user_behavior` — observed user preferences, correction patterns, approval expectations
|
|
172
|
+
- `recurring_issues` — problems that keep appearing, with their symptoms and known resolutions
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Pattern Decay Rules
|
|
177
|
+
|
|
178
|
+
Patterns that are not reinforced within 30 days become less reliable. Apply decay when reading `patterns.json` during any blackboard operation:
|
|
179
|
+
|
|
180
|
+
| Current Confidence | Days Since `last_reinforced` | Action |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| `high` | > 30 days | Reduce to `medium` |
|
|
183
|
+
| `medium` | > 30 days | Reduce to `low` |
|
|
184
|
+
| `low` | > 30 days | Remove from `patterns.json` |
|
|
185
|
+
|
|
186
|
+
Decay is applied in-place: read `patterns.json`, compute which entries have expired, reduce or remove them, write the file back.
|
|
187
|
+
|
|
188
|
+
Do not decay entries that have been reinforced recently — `last_reinforced` is updated each time a new experience confirms the same pattern.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## How the Mind Uses Reflexion During Orient
|
|
193
|
+
|
|
194
|
+
Orient is the second phase of the OODA loop (Observe → Orient → Decide → Act). It is where the mind interprets current context and forms a plan. Reflexion inserts prior experience directly into Orient:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
Orient Phase Protocol:
|
|
198
|
+
|
|
199
|
+
1. Read experiences/index.json
|
|
200
|
+
2. Filter by current task_type + tag overlap
|
|
201
|
+
3. Load top 3–5 experience files (most recent first; prefer confidence: high)
|
|
202
|
+
4. Read patterns.json → filter patterns relevant to the current task domain
|
|
203
|
+
5. Apply decay to any patterns with last_reinforced > 30 days
|
|
204
|
+
6. Synthesize a prior-experience summary:
|
|
205
|
+
- List the most relevant lessons from loaded experiences
|
|
206
|
+
- Note any patterns that apply (from patterns.json)
|
|
207
|
+
- Flag any recurring issues that match the current task's context
|
|
208
|
+
7. Use this summary as the first input when forming the execution plan
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The synthesis does not need to be formal. A short bullet list of 3–5 observations from past experience is sufficient. The goal is to surface "things that have gone wrong before in situations like this" before committing to an approach.
|
|
212
|
+
|
|
213
|
+
### Retrieval Priority
|
|
214
|
+
|
|
215
|
+
When loading experience files, prioritize in this order:
|
|
216
|
+
1. `confidence: "high"` entries over `"medium"` over `"low"`
|
|
217
|
+
2. `outcome: "success"` for positive lessons (what to repeat)
|
|
218
|
+
3. `outcome: "failure"` for cautionary lessons (what to avoid)
|
|
219
|
+
4. Most recent `recorded_at` as tiebreaker
|
|
220
|
+
|
|
221
|
+
Load both success and failure experiences — learning what not to do is as valuable as learning what works.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Cold-Start Behavior
|
|
226
|
+
|
|
227
|
+
The blackboard starts empty. During the first ~10 interactions (`total_count < 10` in `index.json`):
|
|
228
|
+
|
|
229
|
+
- Record EVERY completed task, even trivial ones
|
|
230
|
+
- Set `confidence: "low"` on all entries — they have not been cross-validated
|
|
231
|
+
- Prioritize breadth of recording over depth of analysis — getting entries into the index quickly is more valuable than perfect lesson articulation
|
|
232
|
+
- Do not skip recording because a task "was simple" — even trivial tasks reveal conventions and constraints that are useful context
|
|
233
|
+
|
|
234
|
+
The cold-start window is how the system bootstraps its memory. By the 10th interaction, retrieval should already be returning context that reduces repeated mistakes.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Quick Reference
|
|
239
|
+
|
|
240
|
+
| Concept | Rule |
|
|
241
|
+
|---|---|
|
|
242
|
+
| When to reflect | After every trigger event — do not wait for retro |
|
|
243
|
+
| Reflection format | "I [outcome] at [task] because [reason]. Next time: [adjustment]. Confidence: [level]." |
|
|
244
|
+
| Experience file location | `~/.claude/ftm-state/blackboard/experiences/YYYY-MM-DD_task-slug.json` |
|
|
245
|
+
| Schema reference | `blackboard-schema.md` section 3 |
|
|
246
|
+
| Promotion threshold | 3+ occurrences → `low` confidence; 5+ → `medium`; 8+ → `high` |
|
|
247
|
+
| Decay window | 30 days without reinforcement → reduce confidence one level; at `low` → remove |
|
|
248
|
+
| Orient integration | Load 3–5 matching experiences + relevant patterns before forming any plan |
|
|
249
|
+
| Cold-start rule | Record everything until `total_count >= 10`, all at `confidence: "low"` |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Routing Scenarios
|
|
2
|
+
|
|
3
|
+
Use these as behavioral tests for the Orient → Decide pipeline.
|
|
4
|
+
|
|
5
|
+
| Input | What Orient notices | Decision |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `debug this flaky test` | bug, uncertainty, likely multiple hypotheses | route to `ftm-debug` |
|
|
8
|
+
| `help me think through auth design` | ideation, architecture, not implementation yet | route to `ftm-brainstorm` |
|
|
9
|
+
| `execute ~/.claude/plans/foo.md` | explicit plan path and execution ask | route to `ftm-executor` |
|
|
10
|
+
| `rename this variable` | one obvious local edit, tiny blast radius | handle directly as `micro` |
|
|
11
|
+
| `what would other AIs think about this approach` | explicit multi-model request | route to `ftm-council` |
|
|
12
|
+
| `audit the wiring` | structural verification request | route to `ftm-audit` |
|
|
13
|
+
| Jira ticket URL only | ticket-driven work, intent not yet clear | fetch via `mcp-atlassian-personal`, then re-orient |
|
|
14
|
+
| `check my calendar and draft a slack message` | mixed-domain workflow, read + external draft/send boundary | read calendar, draft Slack, ask before send |
|
|
15
|
+
| `make this better` | ambiguous, insufficient anchor | ask one focused clarifying question |
|
|
16
|
+
| `/ftm help` | explicit help/menu request | show help menu |
|
|
17
|
+
| `I just committed the fix, now check it` | continuation, recent commit validation | inspect diff, run tests or audit, then report |
|
|
18
|
+
| `/ftm-debug auth race condition` | explicit skill choice | respect explicit route to `ftm-debug` |
|
|
19
|
+
| `/ftm-brainstorm replacement for Okta hooks` | explicit design-phase route | respect explicit route to `ftm-brainstorm` |
|
|
20
|
+
| `open the page and tell me what looks broken` | visual/browser task | route to `ftm-browse` or use browser support if already in-flow |
|
|
21
|
+
| `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 |
|
|
22
|
+
| `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 |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Routing Scenarios Reference
|
|
2
|
+
|
|
3
|
+
Use these as behavioral tests for the Decide phase.
|
|
4
|
+
|
|
5
|
+
| Input | What Orient notices | Decision |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `debug this flaky test` | bug, uncertainty, likely multiple hypotheses | route to `ftm-debug` |
|
|
8
|
+
| `help me think through auth design` | ideation, architecture, not implementation yet | route to `ftm-brainstorm` |
|
|
9
|
+
| `execute ~/.claude/plans/foo.md` | explicit plan path and execution ask | route to `ftm-executor` |
|
|
10
|
+
| `rename this variable` | one obvious local edit, tiny blast radius | handle directly as `micro` |
|
|
11
|
+
| `what would other AIs think about this approach` | explicit multi-model request | route to `ftm-council` |
|
|
12
|
+
| `audit the wiring` | structural verification request | route to `ftm-audit` |
|
|
13
|
+
| Jira ticket URL only | ticket-driven work, intent not yet clear | fetch via `mcp-atlassian-personal`, then re-orient |
|
|
14
|
+
| `check my calendar and draft a slack message` | mixed-domain workflow, read + external draft/send boundary | read calendar, draft Slack, ask before send |
|
|
15
|
+
| `make this better` | ambiguous, insufficient anchor | ask one focused clarifying question |
|
|
16
|
+
| `/ftm help` | explicit help/menu request | show help menu |
|
|
17
|
+
| `I just committed the fix, now check it` | continuation, recent commit validation | inspect diff, run tests or audit, then report |
|
|
18
|
+
| `/ftm-debug auth race condition` | explicit skill choice | respect explicit route to `ftm-debug` |
|
|
19
|
+
| `/ftm-brainstorm replacement for Okta hooks` | explicit design-phase route | respect explicit route to `ftm-brainstorm` |
|
|
20
|
+
| `open the page and tell me what looks broken` | visual/browser task | route to `ftm-browse` or use browser support if already in-flow |
|
|
21
|
+
| `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 |
|
|
22
|
+
| `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 |
|
|
23
|
+
| `research parallel agent architectures` | research task, factual inquiry, broad scope | route to `ftm-researcher` (deep) |
|
|
24
|
+
| `what's the best way to handle auth in Next.js` | research task, specific technical question | route to `ftm-researcher` (standard) |
|
|
25
|
+
| `quick look at how Stripe handles webhooks` | research task, explicit "quick" signal | route to `ftm-researcher` (quick) |
|
|
26
|
+
| `compare Redis vs Memcached for our session store` | research task, comparative, codebase-relevant | route to `ftm-researcher` (deep, codebase-aware) |
|
|
27
|
+
| `find me examples of rate limiting middleware` | research task, looking for implementations | route to `ftm-researcher` (standard) |
|
|
28
|
+
| `I want to build a dashboard` | ideation, not research | route to `ftm-brainstorm` (calls researcher internally) |
|
|
29
|
+
| `/ftm-researcher auth patterns in microservices` | explicit skill choice | respect explicit route to `ftm-researcher` |
|
|
30
|
+
| `what breaks if I change handleAuth` | structural query, blast radius, specific symbol | route to `ftm-map` (query: blast-radius) |
|
|
31
|
+
| `map this codebase` | indexing request, no map.db exists | route to `ftm-map` (bootstrap mode) |
|
|
32
|
+
| `where do we handle authentication` | code search, structural | route to `ftm-map` (query: search) |
|
|
33
|
+
| `what depends on the UserService class` | dependency chain, specific symbol | route to `ftm-map` (query: deps) |
|
|
34
|
+
| `show me everything about the parseConfig function` | symbol info request | route to `ftm-map` (query: info) |
|
|
35
|
+
| `/ftm-map blast-radius handlePayment` | explicit skill choice | respect explicit route to `ftm-map` |
|
package/ftm-mind.yml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
name: ftm-mind
|
|
2
|
+
description: Unified cognitive loop for the ftm skill system. Receives any input and contextualizes it against codebase state, accumulated experience, available capabilities, and task complexity before deciding how to act. Use when user says "/ftm-mind", "/ftm" followed by freeform text, or provides any input that needs intelligent routing, decomposition, or multi-step reasoning. Handles everything from micro tasks ("rename this variable") to large projects ("build this feature") by sizing complexity and selecting the right execution strategy. Replaces keyword-matching routing with OODA-based reasoning. Do NOT use when user explicitly invokes a specific ftm skill by name — those route directly.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ftm-pause
|
|
3
|
+
description: Save the current ftm skill session state so work can be resumed in a new conversation. Use when user says "pause", "save state", "I need to stop", "continue later", "ftm pause", "save progress", or is about to end a session mid-workflow. Works with any ftm skill (brainstorm, executor, debug, council, audit).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Events
|
|
7
|
+
|
|
8
|
+
### Emits
|
|
9
|
+
- `session_paused` — when the session state has been successfully serialized and written to disk
|
|
10
|
+
- `task_completed` — when the pause workflow finishes (state file written and confirmation presented)
|
|
11
|
+
|
|
12
|
+
### Listens To
|
|
13
|
+
(none — ftm-pause is explicitly invoked by the user and does not respond to events)
|
|
14
|
+
|
|
15
|
+
# FTM Pause — Session State Capture
|
|
16
|
+
|
|
17
|
+
Save the full state of any active ftm skill session to disk so it can be resumed in a new conversation with zero context loss.
|
|
18
|
+
|
|
19
|
+
## Step 1: Detect the Active FTM Skill
|
|
20
|
+
|
|
21
|
+
Scan the current conversation context to determine which ftm skill is active. Look for these signals:
|
|
22
|
+
|
|
23
|
+
| Signal | Skill |
|
|
24
|
+
|--------|-------|
|
|
25
|
+
| Phase 0 repo scan, intake rounds, research sprints, 5-suggestion format, plan generation | **ftm-brainstorm** |
|
|
26
|
+
| Plan analysis, agent team assembly, worktree setup, wave dispatch, task completion tracking | **ftm-executor** |
|
|
27
|
+
| Problem intake, investigation plan, war room agents (instrumenter/researcher/reproducer/hypothesizer), solver/reviewer loop | **ftm-debug** |
|
|
28
|
+
| Council prompt framing, multi-model dispatch (Claude/Codex/Gemini), rebuttal rounds, alignment checks | **ftm-council** |
|
|
29
|
+
| Project pattern detection, knip analysis, adversarial audit, auto-fix, wiring contracts | **ftm-audit** |
|
|
30
|
+
|
|
31
|
+
If no ftm skill is active, tell the user: "No active ftm session detected. This skill saves state for ftm-brainstorm, ftm-executor, ftm-debug, ftm-council, and ftm-audit sessions."
|
|
32
|
+
|
|
33
|
+
If multiple skills have been invoked in the same conversation (e.g., brainstorm followed by executor), capture the most recently active one. If the user says which one to save, respect that.
|
|
34
|
+
|
|
35
|
+
## Step 2: Capture State by Skill Type
|
|
36
|
+
|
|
37
|
+
Read `references/protocols/SKILL-RESTORE-PROTOCOLS.md` for the full per-skill capture specification. Each skill section defines exactly which fields must be captured and what is required for reliable restoration.
|
|
38
|
+
|
|
39
|
+
Capture every field listed for the detected skill. Do not omit fields because a phase hasn't been reached yet — record those as "not started" or "N/A" so ftm-resume knows the session stopped before that phase.
|
|
40
|
+
|
|
41
|
+
## Step 3: Gather Artifacts
|
|
42
|
+
|
|
43
|
+
Scan the conversation and filesystem for artifacts created during the session:
|
|
44
|
+
|
|
45
|
+
- **Plan files**: `~/.claude/plans/*.md`
|
|
46
|
+
- **Research documents**: Any `.md` files created by agents (RESEARCH-FINDINGS.md, HYPOTHESES.md, REPRODUCTION.md, FIX-SUMMARY.md, REVIEW-VERDICT.md, DEBUG-INSTRUMENTATION.md)
|
|
47
|
+
- **Worktree branches**: Run `git worktree list` and `git branch --list "plan-exec/*" "debug/*"` to capture active branches
|
|
48
|
+
- **Audit changelogs**: Any ftm audit changelog output
|
|
49
|
+
- **Brain dump extractions**: If Path B brainstorm, the structured extraction
|
|
50
|
+
|
|
51
|
+
For each artifact, record its absolute path and verify it still exists on disk.
|
|
52
|
+
|
|
53
|
+
## Step 4: Write the State File
|
|
54
|
+
|
|
55
|
+
Create the directory if it doesn't exist:
|
|
56
|
+
```bash
|
|
57
|
+
mkdir -p ~/.claude/ftm-state
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Write the state file to `~/.claude/ftm-state/STATE.md`. Required structure:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
---
|
|
64
|
+
skill: <skill-name>
|
|
65
|
+
phase: <phase-number-or-name>
|
|
66
|
+
phase_detail: "<human-readable one-liner: exactly where the session stopped>"
|
|
67
|
+
timestamp: <ISO-8601>
|
|
68
|
+
project_dir: <absolute-path>
|
|
69
|
+
git_branch: <branch> # omit if no git repo
|
|
70
|
+
git_commit: <short-hash> # omit if no git repo
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
# FTM Session State
|
|
74
|
+
|
|
75
|
+
## Active Skill
|
|
76
|
+
[One paragraph: skill, phase, path, turn, and current direction]
|
|
77
|
+
|
|
78
|
+
## Context Snapshot
|
|
79
|
+
[Full state for this skill per references/protocols/SKILL-RESTORE-PROTOCOLS.md]
|
|
80
|
+
|
|
81
|
+
## Decisions Made
|
|
82
|
+
[Every decision the user confirmed — use real content, not placeholders]
|
|
83
|
+
|
|
84
|
+
## Open Questions
|
|
85
|
+
[Anything unresolved or about to be explored]
|
|
86
|
+
|
|
87
|
+
## Next Step
|
|
88
|
+
[Specific and actionable: what ftm-resume does first, what the user needs to respond to,
|
|
89
|
+
what research runs next. Must be specific enough to resume without "where were we?"]
|
|
90
|
+
|
|
91
|
+
## Artifacts
|
|
92
|
+
[Absolute path for each artifact, or "none on disk"]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Rules:**
|
|
96
|
+
- `git_commit`: run `git rev-parse --short HEAD`. `git_branch`: run `git branch --show-current`.
|
|
97
|
+
- Include actual content — real URLs, real decisions, real findings. No placeholders.
|
|
98
|
+
- Omit raw agent prompts (the skill files have them) and full file contents (reference by path).
|
|
99
|
+
|
|
100
|
+
See `references/protocols/VALIDATION.md` for the full pre-write and post-write validation checklist.
|
|
101
|
+
|
|
102
|
+
## Step 5: Confirm to User
|
|
103
|
+
|
|
104
|
+
After saving, present a brief confirmation:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Session saved to ~/.claude/ftm-state/STATE.md
|
|
108
|
+
|
|
109
|
+
Captured:
|
|
110
|
+
- Skill: <skill-name>
|
|
111
|
+
- Phase: <phase and detail>
|
|
112
|
+
- <skill-specific counts: decisions, tasks, rounds, findings, etc.>
|
|
113
|
+
- Artifacts: <count and locations, or "none on disk">
|
|
114
|
+
|
|
115
|
+
To resume in a new conversation:
|
|
116
|
+
/ftm-resume
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Tailor the counts to the skill: brainstorm shows decisions + turns, executor shows task completion, debug shows investigation agents, council shows round count + consensus status, audit shows layer completion + finding counts.
|
|
120
|
+
|
|
121
|
+
## Edge Cases
|
|
122
|
+
|
|
123
|
+
**Multiple skills active:** Ask which to save. If "both," save most recent to STATE.md and the other to STATE-[skill].md.
|
|
124
|
+
|
|
125
|
+
**Very early session:** Save what exists — even a Phase 0 scan is worth capturing. "Next Step" should say the user needs to answer the first intake question.
|
|
126
|
+
|
|
127
|
+
**State file already exists:** Overwrite it. Prior state was either consumed or abandoned. FTM-resume archives before loading if the user needs the old one.
|
|
128
|
+
|
|
129
|
+
**No git repo:** Omit `git_branch` and `git_commit` fields. Record `project_dir` only.
|
|
130
|
+
|
|
131
|
+
**Skill invoked, no user interaction yet:** Save what exists (Phase 0 scan, initial question). "Next Step" notes that the user hasn't answered yet.
|
|
132
|
+
|
|
133
|
+
**Large state:** Do not truncate. Some sessions produce massive state files. Completeness is required for reliable restoration.
|