autonomous-flow-daemon 1.1.0 → 1.9.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/CHANGELOG.md +85 -46
- package/LICENSE +21 -21
- package/README-ko.md +282 -0
- package/README.md +282 -337
- package/mcp-config.json +10 -10
- package/package.json +14 -6
- package/src/adapters/index.ts +370 -159
- package/src/cli.ts +162 -57
- package/src/commands/benchmark.ts +187 -0
- package/src/commands/correlate.ts +180 -0
- package/src/commands/dashboard.ts +404 -0
- package/src/commands/diagnose.ts +56 -14
- package/src/commands/doctor.ts +243 -0
- package/src/commands/evolution.ts +190 -0
- package/src/commands/fix.ts +158 -138
- package/src/commands/hooks.ts +136 -0
- package/src/commands/lang.ts +41 -41
- package/src/commands/mcp.ts +129 -0
- package/src/commands/plugin.ts +110 -0
- package/src/commands/restart.ts +14 -0
- package/src/commands/score.ts +276 -208
- package/src/commands/start.ts +155 -96
- package/src/commands/stats.ts +103 -0
- package/src/commands/status.ts +157 -0
- package/src/commands/stop.ts +68 -49
- package/src/commands/suggest.ts +211 -0
- package/src/commands/sync.ts +567 -21
- package/src/commands/vaccine.ts +177 -0
- package/src/constants.ts +32 -8
- package/src/core/boast.ts +280 -265
- package/src/core/config.ts +49 -49
- package/src/core/correlation-engine.ts +265 -0
- package/src/core/db.ts +145 -46
- package/src/core/discovery.ts +65 -65
- package/src/core/evolution.ts +215 -0
- package/src/core/federation.ts +129 -0
- package/src/core/hologram/engine.ts +71 -0
- package/src/core/hologram/fallback.ts +11 -0
- package/src/core/hologram/go-extractor.ts +203 -0
- package/src/core/hologram/incremental.ts +227 -0
- package/src/core/hologram/py-extractor.ts +132 -0
- package/src/core/hologram/rust-extractor.ts +244 -0
- package/src/core/hologram/ts-extractor.ts +406 -0
- package/src/core/hologram/types.ts +27 -0
- package/src/core/hologram.ts +73 -243
- package/src/core/hook-manager.ts +259 -0
- package/src/core/i18n/messages.ts +309 -266
- package/src/core/immune.ts +8 -123
- package/src/core/locale.ts +88 -88
- package/src/core/log-rotate.ts +33 -0
- package/src/core/log-utils.ts +38 -0
- package/src/core/lru-map.ts +61 -0
- package/src/core/notify.ts +74 -66
- package/src/core/plugin-manager.ts +225 -0
- package/src/core/rule-engine.ts +287 -0
- package/src/core/rule-suggestion.ts +127 -0
- package/src/core/semantic-diff.ts +432 -0
- package/src/core/telemetry.ts +94 -0
- package/src/core/vaccine-registry.ts +212 -0
- package/src/core/validator-generator.ts +224 -0
- package/src/core/workspace.ts +28 -0
- package/src/core/yaml-minimal.ts +176 -0
- package/src/daemon/client.ts +78 -37
- package/src/daemon/event-batcher.ts +108 -0
- package/src/daemon/guards.ts +13 -0
- package/src/daemon/http-routes.ts +376 -0
- package/src/daemon/mcp-handler.ts +575 -0
- package/src/daemon/mcp-subscriptions.ts +81 -0
- package/src/daemon/mesh.ts +51 -0
- package/src/daemon/server.ts +655 -504
- package/src/daemon/types.ts +121 -0
- package/src/daemon/workspace-map.ts +104 -0
- package/src/platform.ts +60 -39
- package/src/version.ts +15 -0
- package/README.ko.md +0 -306
package/README.md
CHANGED
|
@@ -1,337 +1,282 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://capsule-render.vercel.app/api?type=soft&color=auto&height=200§ion=header&text=afd&fontSize=90" alt="afd" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h3 align="center">The
|
|
6
|
-
<p align="center"><strong>Self-healing AI
|
|
7
|
-
|
|
8
|
-
<p align="center">
|
|
9
|
-
<a href="https://github.com/dotoricode/autonomous-flow-daemon">
|
|
10
|
-
<img src="demo.gif" width="850" alt="afd demo" style="border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.4);">
|
|
11
|
-
</a>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| **
|
|
127
|
-
| **
|
|
128
|
-
| **
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
afd
|
|
171
|
-
afd
|
|
172
|
-
afd
|
|
173
|
-
afd
|
|
174
|
-
afd
|
|
175
|
-
afd
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
`afd
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
|
228
|
-
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
###
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Manual
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
afd start # starts daemon in background, injects hooks
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
Once registered, Claude Code will display the live status line:
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
🛡️ afd: ON | 🩹 3 Healed | last: IMM-003
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
## Tech Stack
|
|
302
|
-
|
|
303
|
-
| Layer | Technology | Why |
|
|
304
|
-
|:------|:-----------|:----|
|
|
305
|
-
| Runtime | **Bun** | Native TypeScript, fast SQLite, single binary |
|
|
306
|
-
| Database | **Bun SQLite (WAL)** | 0.29ms reads, 24ms writes, crash-safe |
|
|
307
|
-
| Watching | **Chokidar** | Cross-platform, battle-tested file watcher |
|
|
308
|
-
| Patching | **RFC 6902 JSON-Patch** | Deterministic, composable file mutations |
|
|
309
|
-
| CLI | **Commander.js** | Standard, zero-surprise command parsing |
|
|
310
|
-
| i18n | **Built-in engine** | Zero-dependency locale switching in 0.01ms |
|
|
311
|
-
|
|
312
|
-
---
|
|
313
|
-
|
|
314
|
-
## Installation
|
|
315
|
-
|
|
316
|
-
```bash
|
|
317
|
-
# With Bun (recommended)
|
|
318
|
-
bun install
|
|
319
|
-
bun link
|
|
320
|
-
afd start
|
|
321
|
-
|
|
322
|
-
# With npx (no install)
|
|
323
|
-
npx @dotoricode/afd start
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### Requirements
|
|
327
|
-
|
|
328
|
-
- **Bun** >= 1.0
|
|
329
|
-
- **OS**: Windows, macOS, Linux
|
|
330
|
-
- **Target**: Claude Code, Cursor (ecosystem auto-detected)
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## License
|
|
335
|
-
|
|
336
|
-
MIT
|
|
337
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://capsule-render.vercel.app/api?type=soft&color=auto&height=200§ion=header&text=afd&fontSize=90" alt="afd" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h3 align="center">The Invisible Guardian for AI Agents</h3>
|
|
6
|
+
<p align="center"><strong>Self-healing environments + 84% token savings. Your AI breaks things — afd fixes them in 184ms.</strong></p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/dotoricode/autonomous-flow-daemon">
|
|
10
|
+
<img src="demo.gif" width="850" alt="afd demo" style="border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.4);">
|
|
11
|
+
</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="https://img.shields.io/badge/version-1.6.0-blue?style=flat-square" alt="version" />
|
|
16
|
+
<a href="https://www.npmjs.com/package/autonomous-flow-daemon"><img src="https://img.shields.io/npm/v/autonomous-flow-daemon?style=flat-square&logo=npm&color=cb0000" alt="npm" /></a>
|
|
17
|
+
<img src="https://img.shields.io/badge/runtime-Bun-f472b6?style=flat-square&logo=bun" alt="Bun" />
|
|
18
|
+
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT" />
|
|
19
|
+
<img src="https://img.shields.io/badge/built%20for-Claude%20Code-7c3aed?style=flat-square" alt="Claude Code" />
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="README-ko.md">한국어</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## The Numbers Don't Lie
|
|
29
|
+
|
|
30
|
+
| Situation | Without afd | With afd |
|
|
31
|
+
|:----------|:------------|:---------|
|
|
32
|
+
| AI deletes `.claudeignore` | **30 min** manual fix | **0.2s** auto-heal |
|
|
33
|
+
| Hook file corrupted | Re-inject hooks, restart session | **Silent background repair** |
|
|
34
|
+
| `git checkout` triggers 50 events | AI goes haywire | **Mass-event suppressor** |
|
|
35
|
+
| AI reads 8 large files (114KB) | **~28,600 tokens** consumed | **~4,600 tokens** (84% saved) |
|
|
36
|
+
| Session token budget | Burns through context window | **~60,900 tokens saved per codebase scan** |
|
|
37
|
+
|
|
38
|
+
> `< 0.1% CPU` | `~40MB RAM` | `< 270ms` full heal cycle | You never even see it happen.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## One Command to Rule Them All
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx @dotoricode/afd start
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
That's it. Daemon spawns, hooks inject, MCP registers. You're protected.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
$ afd start
|
|
52
|
+
Daemon started (pid 4812, port 52413)
|
|
53
|
+
Smart Discovery: Watching 7 AI-context targets
|
|
54
|
+
Hook injected into .claude/hooks.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## The Problem
|
|
60
|
+
|
|
61
|
+
Your AI agent is powerful but clumsy. It deletes `.claudeignore`, corrupts `hooks.json`, wipes `.cursorrules` — and you don't notice until everything is broken. You stop coding, diagnose the mess, manually restore files. **30 minutes gone. Flow destroyed.**
|
|
62
|
+
|
|
63
|
+
And every time it reads your codebase? Full source files pumped straight into the context window. **Thousands of tokens burned on function bodies it never needed.**
|
|
64
|
+
|
|
65
|
+
## The Solution
|
|
66
|
+
|
|
67
|
+
`afd` runs as an invisible background daemon. It watches your critical files, heals corruption in 184ms, and serves AI agents compressed type skeletons instead of raw source code. Your AI gets the structure it needs at 1/16th the token cost. Accidents get fixed before you notice. Intentional deletions are respected. Zero config, zero interference.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## What's New in v1.6.0
|
|
72
|
+
|
|
73
|
+
| Feature | What Changed |
|
|
74
|
+
|:--------|:-------------|
|
|
75
|
+
| **Tree-sitter AST Engine** | Replaced TypeScript compiler with tree-sitter — multilingual hologram support (TS/JS full, Python/Go/Rust fallback) |
|
|
76
|
+
| **Real-time HUD ROI** | Status bar now shows live session token savings as you work |
|
|
77
|
+
| **Event Batching** | 300ms debounce + dedup — no more event storms from rapid file changes |
|
|
78
|
+
| **Hook Manager** | Multi-owner orchestration — afd coexists cleanly with other hook providers |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Key Features
|
|
83
|
+
|
|
84
|
+
| Feature | What it does |
|
|
85
|
+
|:--------|:-------------|
|
|
86
|
+
| **S.E.A.M Auto-Heal** | File deletion/corruption detected and restored in < 270ms |
|
|
87
|
+
| **Hologram Extraction** | 70-96% lighter file skeletons served to AI agents via MCP |
|
|
88
|
+
| **Smart Reader** | `afd_read` — small files raw, large files auto-compressed, line-range support |
|
|
89
|
+
| **Workspace Map** | `afd://workspace-map` — full file tree + export signatures in one call |
|
|
90
|
+
| **Import-Aware L1** | Only imported symbols get full signatures (85%+ savings) |
|
|
91
|
+
| **Double-Tap** | Delete once = heal; delete again within 30s = respected as intent |
|
|
92
|
+
| **Vaccine Network** | `afd sync` exports learned antibodies across projects |
|
|
93
|
+
| **Self-Evolution** | Quarantined failures become prevention rules automatically |
|
|
94
|
+
| **Mistake History** | PreToolUse hook injects past mistakes as warnings before edits |
|
|
95
|
+
| **HUD Counter** | Status bar shows defense count + token savings at a glance |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Token Savings — Real Measured Data
|
|
100
|
+
|
|
101
|
+
The hologram system is afd's biggest value driver. Here's what we measured in a real session:
|
|
102
|
+
|
|
103
|
+
### Session Snapshot
|
|
104
|
+
|
|
105
|
+
| Metric | Value |
|
|
106
|
+
|:-------|:------|
|
|
107
|
+
| Hologram requests | 55 files analyzed |
|
|
108
|
+
| Target files total size | ~290 KB (55 files, avg 5.3 KB each) |
|
|
109
|
+
| Original token cost | ~72,500 tokens |
|
|
110
|
+
| After hologram compression | ~11,600 tokens |
|
|
111
|
+
| **Tokens saved** | **~60,900 tokens (84% reduction)** |
|
|
112
|
+
|
|
113
|
+
### How It Scales
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Session tokens (at ctx ~15%): ~150,000 ████████████████
|
|
117
|
+
Tokens saved by hologram: ~60,900 ████████░░░░░░░░ (41% of session)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
At ctx 50%+, file reads dominate the token budget. Without hologram, scanning 55 source files costs ~72.5K tokens. With hologram, **each file averages just 16% of its original footprint** — and the gap widens with every repeated read.
|
|
121
|
+
|
|
122
|
+
### Three Layers of Token Optimization
|
|
123
|
+
|
|
124
|
+
| Layer | Tool | Savings | How |
|
|
125
|
+
|:------|:-----|:--------|:----|
|
|
126
|
+
| **L0 Hologram** | `afd_hologram` | 80%+ | Strip function bodies, keep type signatures |
|
|
127
|
+
| **L1 Hologram** | `afd_hologram` + `contextFile` | 85%+ | Filter to only imported symbols |
|
|
128
|
+
| **Smart Reader** | `afd_read` | Auto | Files < 10KB raw, >= 10KB auto-hologram |
|
|
129
|
+
| **Workspace Map** | `afd://workspace-map` | N/A | Entire project structure in one call |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
<details>
|
|
134
|
+
<summary><b>How S.E.A.M Works (internals)</b></summary>
|
|
135
|
+
|
|
136
|
+
Every file event flows through four stages:
|
|
137
|
+
|
|
138
|
+
```mermaid
|
|
139
|
+
graph LR
|
|
140
|
+
S["Sense<br/><i>File Change Detected</i>"] --> E["Extract<br/><i>Detect Symptom</i>"]
|
|
141
|
+
E --> A["Adapt<br/><i>Select Antibody</i>"]
|
|
142
|
+
A --> M["Mutate<br/><i>Apply JSON-Patch</i>"]
|
|
143
|
+
M -->|"Learn"| S
|
|
144
|
+
style S fill:#3b82f6,color:#fff,stroke:none
|
|
145
|
+
style E fill:#f59e0b,color:#fff,stroke:none
|
|
146
|
+
style A fill:#10b981,color:#fff,stroke:none
|
|
147
|
+
style M fill:#ef4444,color:#fff,stroke:none
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
| Stage | What Happens | Speed |
|
|
151
|
+
|:------|:-------------|:------|
|
|
152
|
+
| **Sense** | Chokidar watcher detects `add`, `change`, `unlink` events | < 10ms |
|
|
153
|
+
| **Extract** | Generates hologram (type skeleton) & runs health checks | < 5ms |
|
|
154
|
+
| **Adapt** | Matches symptom to antibody, quarantines corrupted state | < 1ms |
|
|
155
|
+
| **Mutate** | Applies RFC 6902 JSON-Patch to restore the file | < 25ms |
|
|
156
|
+
|
|
157
|
+
> Full cycle: **< 270ms** from file deletion to full recovery.
|
|
158
|
+
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Commands
|
|
164
|
+
|
|
165
|
+
| Command | What it does |
|
|
166
|
+
|:--------|:-------------|
|
|
167
|
+
| `afd start` | Daemon spawn + Smart Discovery + Hook injection + MCP registration |
|
|
168
|
+
| `afd stop` | Shift summary report & graceful shutdown (`--clean` to remove hooks & MCP) |
|
|
169
|
+
| `afd score` | Health dashboard with evolution & hologram metrics |
|
|
170
|
+
| `afd fix` | Symptom detection with hologram context & antibody learning |
|
|
171
|
+
| `afd sync` | Vaccine payload export/import (`--push`, `--pull`, `--remote <url>`) |
|
|
172
|
+
| `afd restart` | Stop + start in one command |
|
|
173
|
+
| `afd status` | Quick health check — daemon, hooks, MCP, defenses |
|
|
174
|
+
| `afd doctor` | Comprehensive health analysis with auto-fix recommendations |
|
|
175
|
+
| `afd evolution` | Analyze quarantined failures & generate prevention rules |
|
|
176
|
+
| `afd mcp install` | Register afd as MCP server in project + global config |
|
|
177
|
+
| `afd vaccine` | List, search, install, publish community antibodies |
|
|
178
|
+
| `afd lang` | Switch display language (`afd lang ko` / `afd lang en`) |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
<details>
|
|
183
|
+
<summary><b>Advanced Intelligence</b></summary>
|
|
184
|
+
|
|
185
|
+
### Double-Tap Heuristic
|
|
186
|
+
|
|
187
|
+
`afd` distinguishes **accidents** from **intent**:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
$ rm .claudeignore # First tap -> afd heals it silently
|
|
191
|
+
$ rm .claudeignore # Second tap within 30s -> "You meant it."
|
|
192
|
+
[afd] Antibody IMM-001 retired. Double-tap detected. Standing down.
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
| Scenario | Response |
|
|
196
|
+
|:---------|:---------|
|
|
197
|
+
| Single delete (accident) | Auto-heal + record first tap |
|
|
198
|
+
| Re-delete within 30s (intent) | Antibody goes dormant, deletion respected |
|
|
199
|
+
| 3+ deletes in 1s (git checkout) | Mass-event detected, all suppression paused |
|
|
200
|
+
|
|
201
|
+
### Vaccine Network
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
afd sync # Export to .afd/global-vaccine-payload.json
|
|
205
|
+
afd sync --push # Push vaccines to remote
|
|
206
|
+
afd sync --pull # Pull vaccines from remote
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The payload is sanitized (no absolute paths, no secrets) and portable.
|
|
210
|
+
|
|
211
|
+
### Self-Evolution
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
afd evolution
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Analyzes quarantined failures and writes prevention rules to `afd-lessons.md`. AI agents read this before editing immune-critical files — turning past failures into future prevention.
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## MCP Setup
|
|
224
|
+
|
|
225
|
+
`afd` provides four MCP tools and one resource:
|
|
226
|
+
|
|
227
|
+
| MCP Tool | Purpose |
|
|
228
|
+
|:---------|:--------|
|
|
229
|
+
| `afd_read` | Smart file reader — raw for small files, auto-hologram for large, optional line ranges |
|
|
230
|
+
| `afd_hologram` | Token-efficient type skeleton of any TS/JS file (80%+ savings) |
|
|
231
|
+
| `afd_diagnose` | Health diagnosis with symptoms and hologram context |
|
|
232
|
+
| `afd_score` | Runtime stats: uptime, heals, hologram savings |
|
|
233
|
+
|
|
234
|
+
| MCP Resource | Purpose |
|
|
235
|
+
|:-------------|:--------|
|
|
236
|
+
| `afd://workspace-map` | Full file tree with export signatures in one call |
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
afd mcp install # Registers in .mcp.json + ~/.claude.json
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
<details>
|
|
245
|
+
<summary><b>Tech Stack</b></summary>
|
|
246
|
+
|
|
247
|
+
| Layer | Technology | Why |
|
|
248
|
+
|:------|:-----------|:----|
|
|
249
|
+
| Runtime | **Bun** | Native TypeScript, fast SQLite, single binary |
|
|
250
|
+
| Database | **Bun SQLite (WAL)** | 0.29ms reads, 24ms writes, crash-safe |
|
|
251
|
+
| Parsing | **Tree-sitter** | Multilingual AST — TS, JS, Python, Go, Rust |
|
|
252
|
+
| Watching | **Chokidar** | Cross-platform, battle-tested file watcher |
|
|
253
|
+
| Patching | **RFC 6902 JSON-Patch** | Deterministic, composable file mutations |
|
|
254
|
+
| CLI | **Commander.js** | Standard, zero-surprise command parsing |
|
|
255
|
+
|
|
256
|
+
</details>
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Installation
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Fastest (no install)
|
|
264
|
+
npx @dotoricode/afd start
|
|
265
|
+
|
|
266
|
+
# With Bun (recommended for development)
|
|
267
|
+
bun install
|
|
268
|
+
bun link
|
|
269
|
+
afd start
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Requirements
|
|
273
|
+
|
|
274
|
+
- **Bun** >= 1.0
|
|
275
|
+
- **OS**: Windows, macOS, Linux
|
|
276
|
+
- **Target**: Claude Code, Cursor, Windsurf, Codex (ecosystem auto-detected)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT
|