feed-the-machine 1.7.12 → 1.7.14
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.
|
@@ -2,177 +2,116 @@
|
|
|
2
2
|
|
|
3
3
|
## Decide
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### 1. Choose execution mode
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- `micro` → direct action
|
|
8
|
+
- `small` → pre-flight summary + action + verify
|
|
9
|
+
- `medium` → checkbox plan, wait for approval, execute
|
|
10
|
+
- `large` → `ftm-brainstorm` (no plan) or `ftm-executor` (plan exists)
|
|
8
11
|
|
|
9
|
-
-
|
|
10
|
-
- `small` -> pre-flight summary, then direct action plus verification
|
|
11
|
-
- `medium` -> numbered plan, wait for approval, then execute
|
|
12
|
-
- `large` -> `ftm-brainstorm` if no plan exists, or `ftm-executor` if a plan exists
|
|
12
|
+
Double-check forced escalation signals from Complexity Sizing reference. If any fired → medium minimum.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### 1.5 Plan Approval
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Read `ftm-config.yml` → `execution.approval_mode`.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
**`auto`**: micro/small just go, medium outlines + executes, large routes to brainstorm/executor.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
**`plan_first`** (recommended):
|
|
21
|
+
- Small: pre-flight summary, proceed unless user objects
|
|
22
|
+
- Medium/large: present checkbox plan, wait for explicit approval
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
Plan format is **mandatory**: `N. [ ] One-line action → target`. See `protocols/PLAN-APPROVAL.md` for spec + examples.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Going ahead unless you say otherwise.
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**For medium and large tasks**: Present a numbered task list and wait for the user to approve.
|
|
37
|
-
|
|
38
|
-
**Step 0: Discovery Interview (if applicable).** Before generating the plan, check whether a Discovery Interview is needed (see Orient reference). If the task involves external systems, stakeholder coordination, or unfamiliar code, run the interview FIRST.
|
|
39
|
-
|
|
40
|
-
**Step 1: Generate the plan.** Build a numbered checkbox list. This format is **mandatory** — no narrative steps, no prose paragraphs. Every plan MUST use: `N. [ ] One-line action → target`. See `references/protocols/PLAN-APPROVAL.md` for the full format spec, examples for code/ops/comms/infra tasks, and the list of NEVER-produce anti-patterns.
|
|
26
|
+
| User says | Action |
|
|
27
|
+
|---|---|
|
|
28
|
+
| approve/go/yes/lgtm | Execute all |
|
|
29
|
+
| skip N | Remove step, execute rest |
|
|
30
|
+
| only N,M | Execute only listed |
|
|
31
|
+
| for step N, [change] | Modify + execute all |
|
|
32
|
+
| add: [desc] after N | Insert, renumber, execute |
|
|
33
|
+
| deny/stop/cancel | Cancel entirely |
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
Execute sequentially. Show `Step 2/5 done: [summary]` after each. If step fails → stop and report.
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|-----------|--------|
|
|
46
|
-
| `approve`, `go`, `yes`, `lgtm`, `ship it` | Execute all steps in order |
|
|
47
|
-
| `skip N` or `skip N,M` | Remove those steps, execute the rest |
|
|
48
|
-
| `only N,M,P` | Execute only the listed steps in order |
|
|
49
|
-
| `for step N, [instruction]` | Replace step N's approach, then execute all |
|
|
50
|
-
| `add: [description] after N` | Insert a new step, renumber, then execute all |
|
|
51
|
-
| `deny`, `stop`, `cancel`, `no` | Cancel. Do not execute anything. |
|
|
52
|
-
| A longer message with mixed feedback | Parse each instruction. Apply all modifications. Present revised plan and ask for final approval. |
|
|
37
|
+
**`always_ask`**: Same as plan_first but also gates small tasks. Only micro skips.
|
|
53
38
|
|
|
54
|
-
|
|
39
|
+
### 2. Direct vs routed
|
|
55
40
|
|
|
56
|
-
|
|
41
|
+
Direct when: micro/small, routing overhead adds no value, faster to just do it.
|
|
42
|
+
Skill when: specialized workflow improves result, user invoked it, medium/large.
|
|
57
43
|
|
|
58
|
-
|
|
59
|
-
Same as `plan_first` but applies to **small** tasks too. Only micro tasks skip the approval gate.
|
|
44
|
+
### 3. Supporting MCP reads
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
When routing to a skill, plan approval still applies if mode is `plan_first` or `always_ask`. Present the strategy for user control.
|
|
46
|
+
Fetch minimum required external context first (ticket, calendar, docs, browser state).
|
|
63
47
|
|
|
64
|
-
###
|
|
48
|
+
### 4. Loop decision
|
|
65
49
|
|
|
66
|
-
|
|
67
|
-
- the work is micro or small
|
|
68
|
-
- routing overhead adds no value
|
|
69
|
-
- the answer can be delivered faster than a delegated workflow
|
|
50
|
+
If next move reveals new information → plan to re-enter Observe after.
|
|
70
51
|
|
|
71
|
-
|
|
72
|
-
- its specialized workflow will materially improve the result
|
|
73
|
-
- the user explicitly invoked it
|
|
74
|
-
- the task is medium/large and the skill is the right vehicle
|
|
52
|
+
## Act
|
|
75
53
|
|
|
76
|
-
###
|
|
54
|
+
### Pre-Act Checkpoint (HARD GATE)
|
|
77
55
|
|
|
78
|
-
|
|
56
|
+
Before executing ANYTHING — Bash, MCP, Write, Edit, API calls:
|
|
79
57
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
1. **Checkbox plan presented?** Medium+ tasks require `N. [ ] action → target` format, approved by user. Prose is NOT a plan.
|
|
59
|
+
2. **User approved?** Wait for explicit go/approve/yes.
|
|
60
|
+
3. **Plan marker written?** Write to `~/.claude/ftm-state/.plan-presented` after approval.
|
|
61
|
+
4. **External mutations approved?** Per Approval Gates in orient-protocol.
|
|
62
|
+
5. None apply (micro/small, no forced escalation) → proceed.
|
|
85
63
|
|
|
86
|
-
|
|
64
|
+
| Rationalization | Reality |
|
|
65
|
+
|---|---|
|
|
66
|
+
| "Do as much as you can" = implicit approval | That's the task description, not plan approval |
|
|
67
|
+
| "I know what to do, plan is overhead" | Plan is for the USER |
|
|
68
|
+
| "Just one small API call first" | One becomes five becomes a full unplanned execution |
|
|
69
|
+
| "User seems impatient" | 30-second plan saves 10 minutes of wrong work |
|
|
87
70
|
|
|
88
|
-
|
|
71
|
+
Applies to ALL execution methods including Bash/curl/python. The plan-gate hook catches Edit/Write/MCP; this checkpoint catches everything else.
|
|
89
72
|
|
|
90
|
-
|
|
73
|
+
### Compare Before You Loop (MANDATORY for external systems)
|
|
91
74
|
|
|
92
|
-
|
|
75
|
+
**Never trial-and-error. Always compare first.**
|
|
93
76
|
|
|
94
|
-
**
|
|
77
|
+
1. **Find working reference** — GET a resource that already works the way you want
|
|
78
|
+
2. **Diff** — compare field-by-field against the broken one. Fix is almost always a small, specific difference
|
|
79
|
+
3. **Targeted change** — change ONLY what the diff revealed. Verify after each change
|
|
95
80
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
**Loop detection red flags:**
|
|
82
|
+
- 3+ API calls to same system without success
|
|
83
|
+
- Trying different URL formats (underscore vs hyphen, internal vs display ID)
|
|
84
|
+
- Shuffling payload fields hoping one works
|
|
85
|
+
- Reading API docs for endpoint paths (playbook should have this)
|
|
101
86
|
|
|
102
|
-
**
|
|
103
|
-
- "The user said 'do as much as you can' — that's implicit approval" → NO. That's the task description, not plan approval.
|
|
104
|
-
- "I know what needs to happen, presenting a plan is just overhead" → NO. The plan is for the USER, not for you.
|
|
105
|
-
- "I'll just start with one small API call to check something" → NO. One call becomes five becomes a full execution without approval.
|
|
106
|
-
- "The user seems impatient" → NO. A 30-second plan saves 10 minutes of unwanted work.
|
|
87
|
+
**On detection:** STOP. Tell user: "Tried N approaches, none worked. Comparing against working reference." Do step 1.
|
|
107
88
|
|
|
108
|
-
|
|
89
|
+
See `references/incidents.md` → Braintrust Incident for the cost of skipping this.
|
|
109
90
|
|
|
110
91
|
### 1. Direct action
|
|
111
92
|
|
|
112
|
-
|
|
113
|
-
- do the work
|
|
114
|
-
- summarize what changed
|
|
115
|
-
|
|
116
|
-
For small tasks (when `approval_mode` is `plan_first` or `always_ask`):
|
|
117
|
-
- show the pre-flight summary first
|
|
118
|
-
- then do the work
|
|
119
|
-
- verify
|
|
120
|
-
- summarize what changed
|
|
93
|
+
Micro: do + summarize. Small (plan_first/always_ask): pre-flight → do → verify → summarize.
|
|
121
94
|
|
|
122
95
|
### 2. Skill routing
|
|
123
96
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Examples:
|
|
127
|
-
- `Routing to ftm-debug: this is a flaky failure with real diagnostic uncertainty.`
|
|
128
|
-
- `Routing to ftm-brainstorm: this is still design-stage and benefits from research-backed planning.`
|
|
129
|
-
|
|
130
|
-
Then invoke the target skill with the full user input.
|
|
97
|
+
Show one routing line, then invoke: `Routing to ftm-debug: flaky failure with diagnostic uncertainty.`
|
|
131
98
|
|
|
132
99
|
### 3. MCP execution
|
|
133
100
|
|
|
134
|
-
|
|
135
|
-
- parallel reads when safe
|
|
136
|
-
- sequential writes
|
|
137
|
-
- approval gates only for external-facing actions
|
|
138
|
-
|
|
139
|
-
### 3.5. Draft-before-send protocol
|
|
140
|
-
|
|
141
|
-
When composing Slack messages, emails, or any outbound communication, always save the draft locally before sending.
|
|
142
|
-
|
|
143
|
-
**Drafts folder**: `.ftm-drafts/` in the project root (or `~/.claude/ftm-drafts/` if no project context).
|
|
101
|
+
Parallel reads, sequential writes, approval gates for external-facing actions.
|
|
144
102
|
|
|
145
|
-
|
|
103
|
+
### 3.5 Draft-before-send
|
|
146
104
|
|
|
147
|
-
- Filename: `YYYY-MM-DD_HH-MM_<type>_<recipient
|
|
148
|
-
- Content includes frontmatter: type, to, subject (email only), drafted timestamp, status (draft/sent/cancelled)
|
|
149
|
-
|
|
150
|
-
**Workflow:**
|
|
151
|
-
1. Compose the message
|
|
152
|
-
2. Save to `.ftm-drafts/`
|
|
153
|
-
3. Present to user for approval
|
|
154
|
-
4. If approved and sent, update `status: sent`
|
|
155
|
-
5. If cancelled or modified, update accordingly
|
|
105
|
+
Slack/email/outbound comms → save to `.ftm-drafts/` first. Filename: `YYYY-MM-DD_HH-MM_<type>_<recipient>.md`. Present for approval, update status on send/cancel.
|
|
156
106
|
|
|
157
107
|
### 4. Blackboard updates (mandatory)
|
|
158
108
|
|
|
159
|
-
After every completed task
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
4. Update `~/.claude/ftm-state/blackboard/experiences/index.json` with the new entry
|
|
165
|
-
|
|
166
|
-
The experience file should capture:
|
|
167
|
-
- `task_type`, `tags`, `outcome`, `lessons`, `files_touched`, `stakeholders`, `decisions_made`
|
|
168
|
-
|
|
169
|
-
Follow the schema and full-file write rules from `blackboard-schema.md`.
|
|
109
|
+
After every completed task:
|
|
110
|
+
1. Update `context.json` — current_task, recent_decisions, session_metadata
|
|
111
|
+
2. Write experience file to `experiences/YYYY-MM-DD_task-slug.json`
|
|
112
|
+
3. Update `experiences/index.json`
|
|
113
|
+
4. Include: task_type, tags, outcome, lessons, files_touched, stakeholders, decisions_made, code_patterns, api_gotchas
|
|
170
114
|
|
|
171
115
|
### 5. Loop
|
|
172
116
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- if complete, answer and stop
|
|
176
|
-
- if new information appeared, return to Observe
|
|
177
|
-
- if blocked by approval or missing info, ask the user
|
|
178
|
-
- if the simple approach failed, re-orient and escalate one level
|
|
117
|
+
Complete → answer and stop. New info → re-observe. Blocked → ask user. Failed → re-orient, escalate one level.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Incident Reference
|
|
2
|
+
|
|
3
|
+
Named incidents referenced by Orient and Decide-Act protocols. Read this file only when an incident name is cited and you need the full context.
|
|
4
|
+
|
|
5
|
+
## Hindsight Incident (March 2026)
|
|
6
|
+
|
|
7
|
+
**What happened**: ftm-mind took an SSO setup task and autonomously created Okta groups, added users to production Okta, created Freshservice records, a service catalog item, and modified S3 workflow configs — all without presenting a plan or asking for approval once.
|
|
8
|
+
|
|
9
|
+
**Root cause**: No plan-first gate existed. The task "felt small" but touched 5+ external systems.
|
|
10
|
+
|
|
11
|
+
**What it taught us**: Any task that calls production APIs is forced-medium. Plans are mandatory. Approval gates are circuit breakers, not suggestions.
|
|
12
|
+
|
|
13
|
+
## Braintrust Incident (April 2026)
|
|
14
|
+
|
|
15
|
+
**What happened**: Freshservice catalog items #626 and #621 were deleted and recreated as #631 and #632 to "fix" duplicate fields. This broke the S3 workflow config (assign_after_app_owner_approval), required emergency patching, and custom_lookup_bigint fields had to be re-added manually.
|
|
16
|
+
|
|
17
|
+
**Root cause**: Three knowledge sources existed (playbook, blackboard, brain.py) and none were consulted. Then, when trial-and-error failed, the model chose a destructive action (delete + recreate) without considering dependencies or asking for approval.
|
|
18
|
+
|
|
19
|
+
**What it taught us**:
|
|
20
|
+
1. Always check playbooks before external system operations
|
|
21
|
+
2. Never delete and recreate external resources — IDs are depended on
|
|
22
|
+
3. Compare working references against broken ones instead of guessing
|
|
23
|
+
4. A one-field diff (`requester_can_edit: "true"`) was the entire fix — discoverable in 30 seconds by comparing the working HR Acuity item against the broken ones
|
|
@@ -1,348 +1,155 @@
|
|
|
1
|
-
# Orient Protocol
|
|
1
|
+
# Orient Protocol
|
|
2
2
|
|
|
3
3
|
## Capability Inventory: FTM Skills
|
|
4
4
|
|
|
5
|
-
Orient must know all ftm capabilities before deciding whether to route or act directly.
|
|
6
|
-
|
|
7
5
|
| Skill | Reach for it when... |
|
|
8
6
|
|---|---|
|
|
9
|
-
| `ftm-brainstorm` |
|
|
10
|
-
| `ftm-executor` |
|
|
11
|
-
| `ftm-debug` |
|
|
12
|
-
| `ftm-audit` |
|
|
13
|
-
| `ftm-council` |
|
|
14
|
-
| `ftm-codex-gate` |
|
|
15
|
-
| `ftm-intent` |
|
|
16
|
-
| `ftm-diagram` |
|
|
17
|
-
| `ftm-browse` |
|
|
18
|
-
| `ftm-pause`
|
|
19
|
-
| `ftm-
|
|
20
|
-
| `ftm-
|
|
21
|
-
| `ftm-
|
|
22
|
-
| `ftm-
|
|
23
|
-
| `ftm-
|
|
24
|
-
| `ftm-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## MCP Inventory Reference
|
|
34
|
-
|
|
35
|
-
Read `~/.claude/skills/ftm-mind/references/mcp-inventory.md` for full MCP server details.
|
|
36
|
-
|
|
37
|
-
Orient must know the available MCPs and their contextual triggers.
|
|
38
|
-
|
|
39
|
-
| MCP server | Reach for it when... |
|
|
7
|
+
| `ftm-brainstorm` | Exploring ideas, designing systems, comparing approaches, research-backed planning |
|
|
8
|
+
| `ftm-executor` | Has a plan doc or wants autonomous multi-task implementation |
|
|
9
|
+
| `ftm-debug` | Broken behavior, errors, flaky tests, crashes, regressions |
|
|
10
|
+
| `ftm-audit` | Wiring checks, dead code analysis, structural verification |
|
|
11
|
+
| `ftm-council` | Multiple AI perspectives, debate, second opinions |
|
|
12
|
+
| `ftm-codex-gate` | Adversarial Codex review or correctness stress test |
|
|
13
|
+
| `ftm-intent` | Function/module purpose docs or INTENT.md updates |
|
|
14
|
+
| `ftm-diagram` | Diagrams, architecture visuals, Mermaid assets |
|
|
15
|
+
| `ftm-browse` | Browser, screenshots, DOM inspection, visual verification |
|
|
16
|
+
| `ftm-pause` / `ftm-resume` | Park or restore session state |
|
|
17
|
+
| `ftm-upgrade` | Check or upgrade ftm skills |
|
|
18
|
+
| `ftm-retro` | Post-run retrospective or execution review |
|
|
19
|
+
| `ftm-config` | Settings, model profiles, feature configuration |
|
|
20
|
+
| `ftm-git` | MANDATORY before any commit/push — secret scanning gate |
|
|
21
|
+
| `ftm-capture` | Save repeatable workflow as routine/playbook. Also suggest proactively when blackboard shows same task_type 2+ times |
|
|
22
|
+
| `ftm-ops` | Tasks, capacity, burnout, stakeholders, meetings, incidents, daily/weekly summaries |
|
|
23
|
+
|
|
24
|
+
Routing: do it directly if small enough. Route to a skill only when the workflow adds clear value. Explicit invocation is a strong signal.
|
|
25
|
+
|
|
26
|
+
## MCP Inventory
|
|
27
|
+
|
|
28
|
+
Read `references/mcp-inventory.md` for full details. Quick heuristics:
|
|
29
|
+
|
|
30
|
+
| Signal | MCP |
|
|
40
31
|
|---|---|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### MCP matching heuristics
|
|
56
|
-
|
|
57
|
-
Use the smallest relevant MCP set.
|
|
58
|
-
|
|
59
|
-
- Jira issue key or Atlassian URL -> `mcp-atlassian-personal` (or the configured personal account name)
|
|
60
|
-
- "internal docs", "runbook", "company wiki", "Glean" -> `glean_default`
|
|
61
|
-
- "how do I use X library" -> `context7`
|
|
62
|
-
- "calendar", "meeting", "free time" -> `google-calendar`
|
|
63
|
-
- "Slack", "channel", "thread", "notify" -> `slack`
|
|
64
|
-
- "email", "Gmail", "draft" -> `gmail`
|
|
65
|
-
- "ticket", "hardware", "access request" -> `freshservice-mcp`
|
|
66
|
-
- "browser", "screenshot", "look at the page" -> `playwright`
|
|
67
|
-
- "talk through trade-offs" -> `sequential-thinking`
|
|
68
|
-
- "SwiftUI" or Apple framework names -> `apple-doc-mcp`
|
|
69
|
-
- "find contact/company" -> `lusha`
|
|
70
|
-
|
|
71
|
-
### Multi-MCP chaining
|
|
72
|
-
|
|
73
|
-
Detect mixed-domain requests early.
|
|
74
|
-
|
|
75
|
-
Examples:
|
|
76
|
-
|
|
77
|
-
- "check my calendar and draft a Slack message" -> `google-calendar` + `slack`
|
|
78
|
-
- "read the Jira ticket, inspect the repo, then propose a fix" -> `mcp-atlassian-personal` + `git`
|
|
79
|
-
- "search internal docs, then update a Confluence page" -> `glean_default` + `mcp-atlassian-personal`
|
|
80
|
-
|
|
81
|
-
Rules:
|
|
82
|
-
|
|
83
|
-
- parallelize reads when safe
|
|
84
|
-
- gather state before proposing writes
|
|
85
|
-
- chain writes sequentially
|
|
32
|
+
| Jira key or Atlassian URL | `mcp-atlassian-personal` |
|
|
33
|
+
| Internal docs, runbook, company wiki | `glean_default` |
|
|
34
|
+
| Library/framework docs | `context7` |
|
|
35
|
+
| Calendar, meeting, free time | `google-calendar` |
|
|
36
|
+
| Slack, channel, thread | `slack` |
|
|
37
|
+
| Email, Gmail, draft | `gmail` |
|
|
38
|
+
| Ticket, hardware, access request | `freshservice-mcp` |
|
|
39
|
+
| Browser, screenshot | `playwright` |
|
|
40
|
+
| Trade-off analysis | `sequential-thinking` |
|
|
41
|
+
| Apple framework | `apple-doc-mcp` |
|
|
42
|
+
| Contact/company lookup | `lusha` |
|
|
43
|
+
|
|
44
|
+
Multi-MCP: parallelize reads, gather state before writes, chain writes sequentially.
|
|
86
45
|
|
|
87
46
|
## Session Trajectory
|
|
88
47
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
- Is the user moving from ideation -> execution -> validation?
|
|
96
|
-
- Did we already choose an approach that this request assumes?
|
|
97
|
-
|
|
98
|
-
Trajectory cues:
|
|
99
|
-
|
|
100
|
-
- brainstorm -> "ok go" usually means plan or executor
|
|
101
|
-
- debug -> "check it now" usually means verify, test, or audit
|
|
102
|
-
- executor -> "pause" means checkpoint, not new work
|
|
103
|
-
- resume -> "what's next?" means restore and continue
|
|
104
|
-
|
|
105
|
-
If a request branches away from the active thread, note that mentally and avoid corrupting the current session model.
|
|
48
|
+
Look for the arc, not just the last message:
|
|
49
|
+
- What happened just before? What did we learn?
|
|
50
|
+
- brainstorm → "ok go" = plan/executor
|
|
51
|
+
- debug → "check it now" = verify/test/audit
|
|
52
|
+
- executor → "pause" = checkpoint
|
|
53
|
+
- resume → "what's next?" = restore and continue
|
|
106
54
|
|
|
107
55
|
## Codebase State
|
|
108
56
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Check:
|
|
112
|
-
|
|
113
|
-
- dirty worktree
|
|
114
|
-
- recent commits
|
|
115
|
-
- active branch
|
|
116
|
-
- user changes in progress
|
|
117
|
-
- whether the request conflicts with local state
|
|
118
|
-
|
|
119
|
-
Use codebase state to answer:
|
|
120
|
-
|
|
121
|
-
- is this safe to do directly?
|
|
122
|
-
- do we need to avoid stepping on unfinished work?
|
|
123
|
-
- is this request actually about the last commit or current unstaged diff?
|
|
124
|
-
- should we inspect a particular module first because recent changes point there?
|
|
125
|
-
|
|
126
|
-
Repo heuristics:
|
|
57
|
+
Check: dirty worktree, recent commits, active branch, in-progress changes, conflicts with request. Clean tree = lower cost of direct action. Uncommitted changes = continuity and risk.
|
|
127
58
|
|
|
128
|
-
|
|
129
|
-
- a clean tree lowers the cost of direct action
|
|
130
|
-
- a just-landed commit suggests review or regression-check behavior
|
|
131
|
-
- a ticket-linked branch suggests the user expects ticket-driven execution
|
|
59
|
+
## Approval Gates (HARD STOP)
|
|
132
60
|
|
|
133
|
-
|
|
61
|
+
**Circuit breaker. External mutations require explicit user approval. No exceptions.**
|
|
134
62
|
|
|
135
|
-
|
|
63
|
+
See `references/incidents.md` → Hindsight Incident for why this exists.
|
|
136
64
|
|
|
137
|
-
|
|
65
|
+
### Requires approval (STOP before each)
|
|
138
66
|
|
|
139
|
-
|
|
67
|
+
Every individual external mutation. "User approved the plan" ≠ "user approved every API call."
|
|
140
68
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
- **
|
|
144
|
-
- **
|
|
145
|
-
- **
|
|
146
|
-
- **
|
|
147
|
-
- **
|
|
148
|
-
- **S3 / cloud storage**: writing or modifying objects
|
|
149
|
-
- **Browser forms**: submitting data through playwright/puppeteer
|
|
69
|
+
- **Okta**: create apps/groups, assign users, modify policies
|
|
70
|
+
- **Freshservice**: create tickets/records/catalog items/custom objects
|
|
71
|
+
- **Jira/Confluence**: create/update issues, pages, comments
|
|
72
|
+
- **Slack/Email**: send messages (draft-before-send applies)
|
|
73
|
+
- **Calendar**: create/modify events
|
|
74
|
+
- **S3/cloud**: write/modify objects
|
|
75
|
+
- **Browser forms**: submit data
|
|
150
76
|
- **Deploys**: any production-affecting operation
|
|
151
|
-
- **Git remote**:
|
|
152
|
-
|
|
153
|
-
When multiple mutations are part of one plan, batch the approval request by phase — not one API call at a time, but not "approve the whole plan" either. Group related mutations and present per-phase.
|
|
154
|
-
|
|
155
|
-
### Destructive Actions (EXTRA HARD GATE — NEVER WITHOUT EXPLICIT CONFIRMATION)
|
|
156
|
-
|
|
157
|
-
Deleting, replacing, or recreating external resources is a **separate, higher gate** than creating or updating them. These actions are often irreversible and break downstream dependencies you can't see.
|
|
158
|
-
|
|
159
|
-
**NEVER do any of these without explicit user confirmation for each specific resource being destroyed:**
|
|
160
|
-
- **DELETE any external resource** (catalog items, custom objects, Okta groups/apps, Jira issues, S3 objects)
|
|
161
|
-
- **Recreate (delete + create)** to "fix" something — the new resource gets a different ID, breaking every automation that references the old one
|
|
162
|
-
- **Overwrite S3 objects** that other systems read from
|
|
163
|
-
- **Remove users from groups** or deactivate accounts
|
|
164
|
-
- **Close/resolve tickets** that others may be watching
|
|
165
|
-
|
|
166
|
-
**The "delete and recreate" trap**: When you can't update a resource cleanly via API, your instinct will be to delete it and create a fresh one. THIS IS ALMOST ALWAYS WRONG. External resources have IDs that other systems depend on — workflow configs, Lambda triggers, approval chains, custom object lookups, S3 references. Deleting breaks all of them silently. Instead:
|
|
167
|
-
1. Tell the user what you can't update via API
|
|
168
|
-
2. Suggest the minimal manual fix (admin UI link + exact steps)
|
|
169
|
-
3. Only delete if the user explicitly says "yes, delete it, I understand the dependencies"
|
|
77
|
+
- **Git remote**: push, PR creation
|
|
170
78
|
|
|
171
|
-
|
|
79
|
+
Batch by phase — not per-call, not whole-plan.
|
|
172
80
|
|
|
173
|
-
###
|
|
81
|
+
### Destructive Actions (EXTRA HARD GATE)
|
|
174
82
|
|
|
175
|
-
|
|
176
|
-
- tests, lint, builds, audits
|
|
177
|
-
- local git operations (branch, commit, inspection)
|
|
178
|
-
- reading from any MCP or API (GET requests)
|
|
179
|
-
- blackboard reads and writes
|
|
180
|
-
- saving drafts to `.ftm-drafts/`
|
|
83
|
+
**NEVER delete/recreate external resources without per-resource user confirmation.**
|
|
181
84
|
|
|
182
|
-
|
|
85
|
+
- DELETE any external resource
|
|
86
|
+
- Recreate (delete + create) — new ID breaks all automation referencing the old one
|
|
87
|
+
- Overwrite S3 objects other systems read
|
|
88
|
+
- Remove users from groups, deactivate accounts
|
|
89
|
+
- Close/resolve tickets others watch
|
|
183
90
|
|
|
184
|
-
|
|
91
|
+
When you can't update via API: tell the user, suggest manual fix (admin UI link + steps). Only delete if user explicitly confirms with dependency awareness. See `references/incidents.md` → Braintrust Incident.
|
|
185
92
|
|
|
186
|
-
-
|
|
187
|
-
- "This is part of the approved plan"
|
|
188
|
-
- "I already started, might as well finish"
|
|
189
|
-
- "It's just one more API call"
|
|
190
|
-
- "The user will appreciate me being proactive"
|
|
93
|
+
### Auto-proceeds (no approval)
|
|
191
94
|
|
|
192
|
-
|
|
95
|
+
Local edits, tests, lint, builds, audits, local git, GET requests, blackboard reads/writes, saving drafts.
|
|
193
96
|
|
|
194
|
-
|
|
97
|
+
### Rationalization traps
|
|
195
98
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
When asking, ask one focused question with concrete choices.
|
|
205
|
-
|
|
206
|
-
### Blackboard-First Rule (MANDATORY before any access/auth questions)
|
|
99
|
+
| Thought | Reality |
|
|
100
|
+
|---|---|
|
|
101
|
+
| "The user clearly wants this" | Present the action, wait for approval |
|
|
102
|
+
| "It's part of the approved plan" | Each mutation needs its own gate |
|
|
103
|
+
| "I already started" | Sunk cost. Stop and ask |
|
|
104
|
+
| "Just one more API call" | That's how incidents start |
|
|
105
|
+
| "User will appreciate proactivity" | User will appreciate not breaking things |
|
|
207
106
|
|
|
208
|
-
|
|
107
|
+
## Blackboard-First Rule (before any access/auth questions)
|
|
209
108
|
|
|
109
|
+
Before asking about credentials, API access, or authorization:
|
|
210
110
|
1. Read `experiences/index.json`
|
|
211
|
-
2. Look for
|
|
212
|
-
3. If
|
|
213
|
-
|
|
214
|
-
- **Do NOT run a discovery interview about authorization.** You have the answer.
|
|
215
|
-
- **Just do the thing.** If the credentials don't work, you'll find out when the API call fails — and that's a better signal than a speculative question.
|
|
216
|
-
4. If no matching experience exists, proceed with asking.
|
|
217
|
-
|
|
218
|
-
This rule exists because users set up repo-level context once (e.g., "my-tools repo has full API access to our admin systems") and expect Claude to remember it across every session. Asking "do you have admin access?" when the blackboard already says "yes, full access" is the #1 frustration signal.
|
|
219
|
-
|
|
220
|
-
### Access Declaration Detection (MANDATORY)
|
|
221
|
-
|
|
222
|
-
When a user declares repo-level access — either explicitly or as part of a task — **immediately write a blackboard experience so it persists across sessions.** Do NOT wait until the task is complete. Write it during Orient, before acting.
|
|
223
|
-
|
|
224
|
-
**Detection triggers** (any of these in the user's message):
|
|
225
|
-
- "I have access to...", "I have credentials for...", "I'm authenticated to..."
|
|
226
|
-
- "this repo has access to...", "we have API keys for..."
|
|
227
|
-
- "just do it, I have the creds", "you have access here", "credentials are configured"
|
|
228
|
-
- "I'm in [repo name] with my credentials"
|
|
229
|
-
- The user tells you to stop asking and just use an API
|
|
230
|
-
- An API call succeeds for the first time in a repo where no access experience exists
|
|
231
|
-
|
|
232
|
-
**What to write** — create an experience file at `~/.claude/ftm-state/blackboard/experiences/learning-{repo-name}-api-access.json`:
|
|
233
|
-
|
|
234
|
-
```json
|
|
235
|
-
{
|
|
236
|
-
"id": "learning-{repo-name}-api-access",
|
|
237
|
-
"timestamp": "{ISO 8601 now}",
|
|
238
|
-
"task_type": "environment-knowledge",
|
|
239
|
-
"tags": ["{repo-name}", "api-access", "environment", "learning"],
|
|
240
|
-
"outcome": "success",
|
|
241
|
-
"description": "User confirmed API access in {repo-name} repo. {any specifics they mentioned — which systems, what kind of access}.",
|
|
242
|
-
"lessons": [
|
|
243
|
-
"{repo-name} repo has configured access to {systems mentioned}",
|
|
244
|
-
"Do not ask about credentials or authorization when working in this repo — just act"
|
|
245
|
-
],
|
|
246
|
-
"confidence": 1.0,
|
|
247
|
-
"code_patterns": [],
|
|
248
|
-
"api_gotchas": []
|
|
249
|
-
}
|
|
250
|
-
```
|
|
111
|
+
2. Look for tags: current repo name, `api-access`, `full-access`, or the target system
|
|
112
|
+
3. If match exists with confidence ≥ 0.7 → don't ask, just act
|
|
113
|
+
4. No match → proceed with asking
|
|
251
114
|
|
|
252
|
-
|
|
115
|
+
## Access Declaration Detection
|
|
253
116
|
|
|
254
|
-
|
|
117
|
+
When user declares repo-level access, **immediately** write a blackboard experience:
|
|
255
118
|
|
|
256
|
-
**
|
|
119
|
+
**Triggers**: "I have access to...", "credentials are configured", "just do it, I have the creds", user tells you to stop asking, or first successful API call in a repo without an access experience.
|
|
257
120
|
|
|
258
|
-
|
|
121
|
+
**Write**: `experiences/learning-{repo-name}-api-access.json` with tags `["{repo-name}", "api-access", "environment", "learning"]`, confidence 1.0. Update index.
|
|
259
122
|
|
|
260
|
-
|
|
123
|
+
## Discovery Interview (medium+ with external systems)
|
|
261
124
|
|
|
262
|
-
**
|
|
125
|
+
**Apply Blackboard-First Rule first.** If blackboard confirms access + task is a direct API operation → skip interview, just do it.
|
|
263
126
|
|
|
264
|
-
|
|
127
|
+
Interview is for genuine unknowns only (stakeholder coordination, multi-system migrations, policy changes). 2-4 focused questions:
|
|
128
|
+
- Who else needs to know?
|
|
129
|
+
- Downstream dependencies?
|
|
130
|
+
- Timeline/approval constraints?
|
|
131
|
+
- Parts to leave as-is?
|
|
265
132
|
|
|
266
|
-
|
|
267
|
-
- Are there downstream systems or automations that depend on what's changing?
|
|
268
|
-
- Is there a timeline or dependency on someone else's approval?
|
|
269
|
-
- Should we also draft a message to anyone about this?
|
|
270
|
-
- Are there parts of this you want left alone for now vs. changed?
|
|
133
|
+
**Skip when**: user provided context, purely local, user said "just do it", or blackboard confirms access for a direct API op.
|
|
271
134
|
|
|
272
|
-
|
|
273
|
-
- The user already provided comprehensive context
|
|
274
|
-
- The task is purely local with no external dependencies
|
|
275
|
-
- The user explicitly says "just do it" or "no questions, go"
|
|
276
|
-
- **The blackboard has an experience confirming API access for this repo + the task is a direct API operation** (not stakeholder coordination or multi-system migration)
|
|
277
|
-
|
|
278
|
-
## Brain.py Task Loading (Observe Phase)
|
|
279
|
-
|
|
280
|
-
During the Orient phase, enrich session context with the user's active operational state by loading tasks via brain.py:
|
|
135
|
+
## Brain.py Task Loading
|
|
281
136
|
|
|
282
137
|
```
|
|
283
138
|
python3 ~/.claude/skills/ftm/bin/brain.py --tasks --task-json
|
|
284
139
|
```
|
|
285
140
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
Skip this step if:
|
|
289
|
-
- brain.py is not present or returns an error (fail gracefully, do not block orientation)
|
|
290
|
-
- The session context already contains recently loaded task state (within 15 minutes)
|
|
291
|
-
- The request is purely local with no operational relevance (e.g., pure code edits)
|
|
292
|
-
|
|
293
|
-
## Playbook Lookup (MANDATORY before any external system operation)
|
|
294
|
-
|
|
295
|
-
**Before executing any operation on an external system (Freshservice, Okta, Jira, Trelica, S3, etc.), check for an existing playbook.** This is not optional. Playbooks encode hard-won lessons — API quirks, encoding requirements, field types that can't be updated, correct endpoint paths. Skipping this step means repeating every mistake the playbook was written to prevent.
|
|
296
|
-
|
|
297
|
-
**Step 1: Check brain.py playbooks.**
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
python3 ~/.claude/skills/ftm/bin/brain.py --playbook-match "[describe the operation]" --playbook-match-source freshservice
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
If a match returns with confidence > 0.2, read the full playbook before proceeding.
|
|
304
|
-
|
|
305
|
-
```
|
|
306
|
-
python3 ~/.claude/skills/ftm/bin/brain.py --playbook-list
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
Also list all playbooks and scan names — sometimes the match query misses a relevant one.
|
|
141
|
+
Load active tasks, surface high-priority via TaskCreate. Skip if brain.py absent, tasks loaded recently (15min), or request is purely local.
|
|
310
142
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
```
|
|
314
|
-
ls docs/playbooks/ 2>/dev/null
|
|
315
|
-
```
|
|
143
|
+
## Playbook Lookup (MANDATORY before external system ops)
|
|
316
144
|
|
|
317
|
-
|
|
145
|
+
**Before any external system operation, check all three knowledge sources:**
|
|
318
146
|
|
|
319
|
-
|
|
147
|
+
1. `brain.py --playbook-match "[operation]"` + `--playbook-list`
|
|
148
|
+
2. `ls docs/playbooks/` in current repo
|
|
149
|
+
3. Blackboard experiences filtered by target system tags — check `code_patterns` and `api_gotchas`
|
|
320
150
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
**What playbooks prevent:**
|
|
324
|
-
- Using raw HTML when Freshservice requires entity-encoded HTML (`html.escape()`)
|
|
325
|
-
- Trying to PUT on `service_catalog/items/{internal_id}` when the correct path is `service-catalog/items/{display_id}`
|
|
326
|
-
- Including `custom_lookup_bigint` fields in API updates (they're admin-UI-only)
|
|
327
|
-
- Deleting and recreating resources when an in-place update works
|
|
328
|
-
- Repeating 10+ failed API calls to discover what the playbook already documents
|
|
329
|
-
|
|
330
|
-
**The April 2026 Braintrust incident**: A playbook existed (`docs/playbooks/freshservice-service-catalog-item.md`), the blackboard had the lesson ("FS rich text tables require html.escape()"), and a brain.py playbook (`fs-hide-catalog-el`) was available. None were consulted. The result: 15+ failed API attempts, accidental creation of duplicate fields, then destructive deletion of two catalog items breaking S3 workflow automation.
|
|
331
|
-
|
|
332
|
-
**If no playbook exists** and the operation succeeds after trial-and-error, the auto-playbook hook should trigger. If it doesn't, proactively invoke ftm-capture to save the working pattern.
|
|
151
|
+
If any source has relevant content, read it before writing code. See `references/incidents.md` → Braintrust Incident for what happens when you skip this.
|
|
333
152
|
|
|
334
153
|
## Orient Synthesis
|
|
335
154
|
|
|
336
|
-
Before leaving Orient,
|
|
337
|
-
|
|
338
|
-
- current outcome the user wants
|
|
339
|
-
- current task type
|
|
340
|
-
- session continuity
|
|
341
|
-
- codebase constraints
|
|
342
|
-
- relevant lessons
|
|
343
|
-
- relevant patterns
|
|
344
|
-
- capability mix
|
|
345
|
-
- smallest correct task size
|
|
346
|
-
- whether approval or clarification is needed
|
|
347
|
-
|
|
348
|
-
Orient is complete only when the next move feels obvious.
|
|
155
|
+
Before leaving Orient, have one clear internal picture: what the user wants, task type, session continuity, codebase constraints, relevant lessons/patterns, capability mix, correct task size, whether approval or clarification is needed. Orient is complete when the next move feels obvious.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feed-the-machine",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.14",
|
|
4
4
|
"description": "A brain upgrade for Claude Code — 26 skills that teach it how to think before acting, remember across conversations, debug like a war room, run plans on autopilot with agent teams, and get second opinions from GPT & Gemini. Plus 15 hooks that automate the boring stuff.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kkudumu",
|