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,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ftm-diagram
|
|
3
|
+
description: Manages the hierarchical ARCHITECTURE.mmd mermaid diagram layer — root module-to-module relationship graph (subway map) and per-module DIAGRAM.mmd function-to-function graphs (street maps). Use when creating or updating architecture diagrams, bootstrapping a new project's diagram layer, or when user says "update diagram", "show architecture", "ftm-diagram", "visualize relationships". Auto-invoked by ftm-executor after every commit to keep diagrams in sync with code changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Events
|
|
7
|
+
|
|
8
|
+
### Emits
|
|
9
|
+
- `documentation_updated` — when one or more .mmd diagram files are written or modified to reflect new or changed modules and functions
|
|
10
|
+
- `task_completed` — when the full diagram sync pass completes (bootstrap or incremental)
|
|
11
|
+
|
|
12
|
+
### Listens To
|
|
13
|
+
- `code_committed` — fast-path: automatically update DIAGRAM.mmd nodes and edges for every changed module after each commit
|
|
14
|
+
|
|
15
|
+
# Architecture Diagram Manager
|
|
16
|
+
|
|
17
|
+
Two-level diagram system: a root subway map of modules and per-module street maps of functions. Both use `.mmd` files (renderable in GitHub and VSCode).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Graph-Powered Mode (ftm-map integration)
|
|
22
|
+
|
|
23
|
+
Before running the standard analysis, check if the project has a code knowledge graph:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
if [ -f ".ftm-map/map.db" ]; then
|
|
27
|
+
# Use graph for faster, more consistent diagram generation
|
|
28
|
+
ftm-map/scripts/.venv/bin/python3 ftm-map/scripts/views.py generate-diagrams "$PROJECT_ROOT"
|
|
29
|
+
else
|
|
30
|
+
# Fall back to standard analysis below
|
|
31
|
+
fi
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
When `.ftm-map/map.db` exists:
|
|
35
|
+
1. Delegate to `views.py generate-diagrams` which reads the graph and produces .mmd files
|
|
36
|
+
2. Diagrams from the graph are structurally accurate (real edges from parsing, not heuristic guesses)
|
|
37
|
+
3. Supports `--files` flag for incremental updates
|
|
38
|
+
|
|
39
|
+
When `.ftm-map/map.db` does NOT exist:
|
|
40
|
+
- Fall back to the existing modes below
|
|
41
|
+
- No breaking change — behavior is identical without the graph
|
|
42
|
+
|
|
43
|
+
## Mental Model
|
|
44
|
+
|
|
45
|
+
| Level | File | Layout | Node = | Purpose |
|
|
46
|
+
|-------|------|---------|--------|---------|
|
|
47
|
+
| Root | `ARCHITECTURE.mmd` | `graph LR` | Module/directory | High-altitude subway map |
|
|
48
|
+
| Module | `src/auth/DIAGRAM.mmd` | `graph TD` | Function | Ground-level street map |
|
|
49
|
+
|
|
50
|
+
**Rule of thumb**: If you're asking "what talks to what?", look at `ARCHITECTURE.mmd`. If you're asking "how does this module work internally?", look at the module's `DIAGRAM.mmd`.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Root ARCHITECTURE.mmd
|
|
55
|
+
|
|
56
|
+
### What it shows
|
|
57
|
+
Module-to-module dependencies. An edge `A --> B` means A imports from / depends on B.
|
|
58
|
+
|
|
59
|
+
### Node shape conventions
|
|
60
|
+
- `[ModuleName]` — standard module or directory
|
|
61
|
+
- `[(Database)]` — data store (Postgres, Redis, SQLite, etc.)
|
|
62
|
+
- `{ExternalService}` — third-party API or external dependency
|
|
63
|
+
- `([Cache])` — caching layer
|
|
64
|
+
|
|
65
|
+
### Example
|
|
66
|
+
```mermaid
|
|
67
|
+
graph LR
|
|
68
|
+
Frontend[Frontend] --> API[API Layer]
|
|
69
|
+
API --> Auth[Auth Module]
|
|
70
|
+
API --> Users[User Module]
|
|
71
|
+
Auth --> DB[(Database)]
|
|
72
|
+
Auth --> Session[Session Manager]
|
|
73
|
+
Users --> DB
|
|
74
|
+
Session --> Cache([Redis Cache])
|
|
75
|
+
Auth --> OAuth{OAuth Provider}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Scaling rule
|
|
79
|
+
Max ~15 nodes. If more modules exist, group related ones into subgraphs:
|
|
80
|
+
```mermaid
|
|
81
|
+
graph LR
|
|
82
|
+
subgraph Core
|
|
83
|
+
Auth[Auth]
|
|
84
|
+
Users[Users]
|
|
85
|
+
Session[Session]
|
|
86
|
+
end
|
|
87
|
+
Frontend --> API[API Layer]
|
|
88
|
+
API --> Core
|
|
89
|
+
Core --> DB[(Database)]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Per-Module DIAGRAM.mmd
|
|
95
|
+
|
|
96
|
+
Place at `<module-path>/DIAGRAM.mmd` (e.g., `src/auth/DIAGRAM.mmd`).
|
|
97
|
+
|
|
98
|
+
### What it shows
|
|
99
|
+
Function-to-function call graph within the module, plus external dependencies the module touches.
|
|
100
|
+
|
|
101
|
+
### Layout: `graph TD` (top-down)
|
|
102
|
+
|
|
103
|
+
### Example
|
|
104
|
+
```mermaid
|
|
105
|
+
graph TD
|
|
106
|
+
authenticate[authenticateUser] --> validate[validateToken]
|
|
107
|
+
authenticate --> create[createSession]
|
|
108
|
+
validate --> decode[decodeJWT]
|
|
109
|
+
create --> store[storeSession]
|
|
110
|
+
store --> redis[(Redis)]
|
|
111
|
+
|
|
112
|
+
subgraph External
|
|
113
|
+
oauth[OAuth Provider]
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
authenticate --> oauth
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Subgraph conventions
|
|
120
|
+
- `subgraph External` — third-party services the module calls
|
|
121
|
+
- `subgraph DB` — database tables the module reads/writes
|
|
122
|
+
- `subgraph Shared` — shared utilities imported from elsewhere
|
|
123
|
+
|
|
124
|
+
### Scaling rule
|
|
125
|
+
Max ~20 function nodes. If more, group by responsibility:
|
|
126
|
+
```mermaid
|
|
127
|
+
graph TD
|
|
128
|
+
subgraph Validation
|
|
129
|
+
validateToken[validateToken]
|
|
130
|
+
decodeJWT[decodeJWT]
|
|
131
|
+
checkExpiry[checkExpiry]
|
|
132
|
+
end
|
|
133
|
+
subgraph Session
|
|
134
|
+
createSession[createSession]
|
|
135
|
+
storeSession[storeSession]
|
|
136
|
+
destroySession[destroySession]
|
|
137
|
+
end
|
|
138
|
+
authenticateUser --> Validation
|
|
139
|
+
authenticateUser --> Session
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Mermaid Syntax Standards
|
|
145
|
+
|
|
146
|
+
- File extension: `.mmd` (not `.md`)
|
|
147
|
+
- Node IDs: `camelCase` (used in edges)
|
|
148
|
+
- Node labels: human-readable in `[brackets]` — e.g., `auth[Authentication]`
|
|
149
|
+
- Edge direction: `-->` for dependencies, `-. optional .->` for optional/conditional
|
|
150
|
+
- No quotes around node IDs unless they contain special characters
|
|
151
|
+
- Renderable as-is in GitHub and VSCode Mermaid Preview
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Bootstrap: New Project
|
|
156
|
+
|
|
157
|
+
When no diagrams exist yet:
|
|
158
|
+
|
|
159
|
+
1. **Scan for modules** — list top-level directories and key files under `src/` (or equivalent)
|
|
160
|
+
2. **Find import relationships** — for each module, grep for `import ... from` statements pointing to other modules
|
|
161
|
+
3. **Generate root ARCHITECTURE.mmd** — one node per module, edges from import graph
|
|
162
|
+
4. **Generate per-module DIAGRAM.mmd** — for each module, list exported functions and their internal call relationships
|
|
163
|
+
|
|
164
|
+
Scan strategy (in order of reliability):
|
|
165
|
+
- Read `package.json` / `tsconfig.json` to understand project structure
|
|
166
|
+
- List directories under `src/` or main source root
|
|
167
|
+
- For each directory, read index files to find public exports
|
|
168
|
+
- Grep for cross-module imports to draw edges
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Incremental Updates
|
|
173
|
+
|
|
174
|
+
When diagrams already exist, do not regenerate from scratch. Read the current diagram, identify what changed, apply the delta.
|
|
175
|
+
|
|
176
|
+
| Event | Action |
|
|
177
|
+
|-------|--------|
|
|
178
|
+
| New module created | Add node to `ARCHITECTURE.mmd` + create `module/DIAGRAM.mmd` |
|
|
179
|
+
| New function created | Add node to module's `DIAGRAM.mmd` with correct edges |
|
|
180
|
+
| Function renamed | Update node ID and label in `DIAGRAM.mmd` |
|
|
181
|
+
| Dependency added | Add edge in relevant diagram(s) |
|
|
182
|
+
| Dependency removed | Remove edge in relevant diagram(s) |
|
|
183
|
+
| Module deleted | Remove node and all its edges from `ARCHITECTURE.mmd`, delete `DIAGRAM.mmd` |
|
|
184
|
+
| Function deleted | Remove node and edges from `DIAGRAM.mmd` |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Simplicity Rules
|
|
189
|
+
|
|
190
|
+
Diagrams that are too complex are useless. Apply these filters before writing:
|
|
191
|
+
|
|
192
|
+
1. **Omit pure utility functions** — `formatDate`, `clamp`, `sleep` don't need nodes unless they're called by many things
|
|
193
|
+
2. **Collapse leaf nodes** — if a function just wraps a DB call, show the DB node, not an intermediate wrapper
|
|
194
|
+
3. **Don't show every import** — only show edges where the dependency is architecturally meaningful
|
|
195
|
+
4. **Prefer clarity over completeness** — a diagram that shows the 80% important relationships is more useful than one that shows everything
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Output Format
|
|
200
|
+
|
|
201
|
+
When creating or updating diagrams, write the `.mmd` file content directly using the Write/Edit tools. Then confirm what was written:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Created: src/ARCHITECTURE.mmd (6 modules, 8 edges)
|
|
205
|
+
Created: src/auth/DIAGRAM.mmd (5 functions, Redis + OAuth dependencies)
|
|
206
|
+
Updated: src/users/DIAGRAM.mmd (added createUser node)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Usage Examples
|
|
212
|
+
|
|
213
|
+
**Bootstrap a new project:**
|
|
214
|
+
> "ftm-diagram — bootstrap diagrams for this project"
|
|
215
|
+
Scan the codebase, generate root + per-module diagrams.
|
|
216
|
+
|
|
217
|
+
**After adding a new module:**
|
|
218
|
+
> "update diagram — I just added src/notifications/"
|
|
219
|
+
Add `Notifications` node to ARCHITECTURE.mmd, create `src/notifications/DIAGRAM.mmd`.
|
|
220
|
+
|
|
221
|
+
**After adding a function:**
|
|
222
|
+
> "update diagram — added sendEmail to src/notifications/"
|
|
223
|
+
Add `sendEmail` node with edges to `src/notifications/DIAGRAM.mmd`.
|
|
224
|
+
|
|
225
|
+
**View current architecture:**
|
|
226
|
+
> "show architecture"
|
|
227
|
+
Read and display `ARCHITECTURE.mmd` + list available module diagrams.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### Auto-Invocation by ftm-executor
|
|
232
|
+
|
|
233
|
+
This skill's format is used by ftm-executor's documentation pipeline. After every commit during plan execution, agents update INTENT.md (or DIAGRAM.mmd) entries following this skill's templates. The updates are automatic and don't require explicit skill invocation — agents reference the format directly.
|
package/ftm-diagram.yml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
name: ftm-diagram
|
|
2
|
+
description: Manages the hierarchical ARCHITECTURE.mmd mermaid diagram layer — root module-to-module relationship graph (subway map) and per-module DIAGRAM.mmd function-to-function graphs (street maps). Use when creating or updating architecture diagrams, bootstrapping a new project's diagram layer, or when user says "update diagram", "show architecture", "ftm-diagram", "visualize relationships". Auto-invoked by ftm-executor after every commit to keep diagrams in sync with code changes.
|