autonomous-flow-daemon 1.6.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 -85
- package/LICENSE +21 -21
- package/README-ko.md +282 -0
- package/README.md +282 -266
- package/mcp-config.json +10 -10
- package/package.json +4 -2
- package/src/adapters/index.ts +370 -370
- package/src/cli.ts +162 -127
- package/src/commands/benchmark.ts +187 -187
- package/src/commands/correlate.ts +180 -0
- package/src/commands/dashboard.ts +404 -0
- package/src/commands/evolution.ts +84 -1
- package/src/commands/fix.ts +158 -158
- package/src/commands/lang.ts +41 -41
- package/src/commands/plugin.ts +110 -0
- package/src/commands/restart.ts +14 -14
- package/src/commands/score.ts +276 -276
- package/src/commands/start.ts +155 -155
- package/src/commands/status.ts +157 -157
- package/src/commands/stop.ts +68 -68
- package/src/commands/suggest.ts +211 -0
- package/src/commands/sync.ts +329 -16
- package/src/constants.ts +32 -32
- package/src/core/boast.ts +280 -280
- package/src/core/config.ts +49 -49
- package/src/core/correlation-engine.ts +265 -0
- package/src/core/db.ts +145 -117
- package/src/core/discovery.ts +65 -65
- package/src/core/federation.ts +129 -0
- package/src/core/hologram/engine.ts +71 -71
- package/src/core/hologram/fallback.ts +11 -11
- package/src/core/hologram/go-extractor.ts +203 -0
- package/src/core/hologram/incremental.ts +227 -227
- package/src/core/hologram/py-extractor.ts +132 -132
- package/src/core/hologram/rust-extractor.ts +244 -0
- package/src/core/hologram/ts-extractor.ts +406 -320
- package/src/core/hologram/types.ts +27 -25
- package/src/core/hologram.ts +73 -71
- package/src/core/i18n/messages.ts +309 -309
- package/src/core/locale.ts +88 -88
- package/src/core/log-rotate.ts +33 -33
- package/src/core/log-utils.ts +38 -38
- package/src/core/lru-map.ts +61 -61
- package/src/core/notify.ts +74 -74
- package/src/core/plugin-manager.ts +225 -0
- package/src/core/rule-suggestion.ts +127 -0
- package/src/core/validator-generator.ts +224 -0
- package/src/core/workspace.ts +28 -28
- package/src/daemon/client.ts +78 -65
- package/src/daemon/event-batcher.ts +108 -108
- package/src/daemon/guards.ts +13 -13
- package/src/daemon/http-routes.ts +376 -293
- package/src/daemon/mcp-handler.ts +575 -270
- package/src/daemon/mcp-subscriptions.ts +81 -0
- package/src/daemon/mesh.ts +51 -0
- package/src/daemon/server.ts +655 -590
- package/src/daemon/types.ts +121 -100
- package/src/daemon/workspace-map.ts +104 -92
- package/src/platform.ts +60 -60
- package/src/version.ts +15 -15
- package/README.ko.md +0 -266
package/CHANGELOG.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to **afd** are documented in this file.
|
|
4
|
-
|
|
5
|
-
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
-
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## [1.5.0] - 2026-04-02 — "Trust-Builder"
|
|
11
|
-
|
|
12
|
-
> The immune system now speaks. Three pillars that make afd's defenses visible, self-improving, and smarter.
|
|
13
|
-
|
|
14
|
-
### Added
|
|
15
|
-
|
|
16
|
-
- **Hologram L1 — Import-Based Semantic Compression**
|
|
17
|
-
- New optional `contextFile` parameter on `afd_hologram` MCP tool and `/hologram` HTTP endpoint
|
|
18
|
-
- `extractImportedSymbols()` function: regex fast-path parsing of named imports, default imports, and namespace imports from the context file
|
|
19
|
-
- L1 filtering in `generateHologram()`: directly imported symbols receive full type signatures; non-imported exports are reduced to name-only stubs with guide text `// details omitted — read directly if needed`
|
|
20
|
-
- Namespace imports (`import * as X`) trigger full L0 hologram (safe default, no false filtering)
|
|
21
|
-
- Silent fallback to L0 when `contextFile` is missing, unreadable, or yields zero import results
|
|
22
|
-
- Compression target: 85%+ with contextFile (vs ~80% L0 baseline)
|
|
23
|
-
- L1 is MCP/HTTP path only — S.E.A.M hot path remains L0 to protect the 270ms budget
|
|
24
|
-
|
|
25
|
-
- **Antibody Passive Defense — Mistake History Injection**
|
|
26
|
-
- New `mistake_history` SQLite table: `file_path`, `mistake_type`, `description` (max 200 chars), `antibody_id`, `timestamp`
|
|
27
|
-
- Indexes on `file_path` and `timestamp` for sub-millisecond query performance
|
|
28
|
-
- Write-through cache: `mistakeCache: Map<string, MistakeEntry[]>` loaded on daemon startup, updated on every insert
|
|
29
|
-
- Per-file cap of 5 most recent entries enforced at write time
|
|
30
|
-
- 30-day TTL purge on daemon startup (consistent with `telemetry` table pattern)
|
|
31
|
-
- Direct DB insert on auto-heal events (not via HTTP POST): records `mistake_type` from `symptom.patternType` and `description` from `symptom.title`
|
|
32
|
-
- New GET `/mistake-history?file=<path>` HTTP endpoint (returns max 5 entries, most recent first)
|
|
33
|
-
- `pastMistakes` field injected into `afd diagnose --format a2a` output on both the healthy path (proactive warning) and the auto-heal path (reactive)
|
|
34
|
-
- `pastMistakes` is omitted entirely when no history exists (zero token overhead)
|
|
35
|
-
- Path normalization: `file_path` stored with forward slashes (cross-platform safe)
|
|
36
|
-
|
|
37
|
-
- **HUD Defense Counter + Reasons**
|
|
38
|
-
- `/mini-status` endpoint enhanced with `total_defenses: number` and `defense_reasons: string[]` (in-memory only, no DB query — always under 200ms)
|
|
39
|
-
- `defense_reasons` derived from in-memory `state.autoHealLog` (capped at 100 entries), returning up to 3 most recent unique `mistake_type` values
|
|
40
|
-
- Status bar format: `[afd] {N}건 방어 ({reason1}, {reason2}, ...)` when defenses exist; `[afd] ON` when none
|
|
41
|
-
- Existing `healed_count` and `last_healed` fields preserved for backward compatibility
|
|
42
|
-
|
|
43
|
-
### Fixed
|
|
44
|
-
|
|
45
|
-
- **Windows path normalization in `assertInsideWorkspace()`**: backslash (`\`) separators in Windows paths are now normalized to forward slashes before workspace boundary checks, fixing false-positive "outside workspace" errors on Windows
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## [1.0.0] - 2026-03-31 — "The Immortal Flow"
|
|
50
|
-
|
|
51
|
-
> [afd] 🛡️ AI agent deleted '.claudeignore' | 🩹 Self-healed in 184ms | Context preserved.
|
|
52
|
-
|
|
53
|
-
**Zero-config immunity for your AI development flow.**
|
|
54
|
-
|
|
55
|
-
### Phase 1–3: Core S.E.A.M Engine & Magic 5 Commands
|
|
56
|
-
|
|
57
|
-
- Introduced the **S.E.A.M Cycle** (Scan → Evaluate → Act → Monitor) as the central execution loop
|
|
58
|
-
- Implemented the **Magic 5 Commands**: `start`, `stop`, `score`, `fix`, `sync`
|
|
59
|
-
- Built `src/core/db.ts`: WAL-mode SQLite for sub-100ms file event persistence
|
|
60
|
-
- Built `src/core/hologram.ts`: AST-based skeleton extraction for token-efficient AI handoff
|
|
61
|
-
- Built `src/core/immune.ts`: Immune tolerance heuristics — suppression logic for noisy events
|
|
62
|
-
- Implemented `src/daemon/server.ts` and `src/daemon/client.ts`: Unix socket IPC for daemon ↔ CLI communication
|
|
63
|
-
- Chokidar-backed file watcher with 100ms debounce in `src/daemon/server.ts`
|
|
64
|
-
|
|
65
|
-
### Phase 4–5: Multilingual UI & Status Line Integration
|
|
66
|
-
|
|
67
|
-
- Added bilingual terminal UI (EN/KO) with chalk-based color output
|
|
68
|
-
- Integrated **Status Line** hook injection for Claude Code, Cursor, and Copilot adapters
|
|
69
|
-
- Added adapter layer (`src/adapters/`) for ecosystem-specific configuration
|
|
70
|
-
- Published `README.md` (English) and `README.ko.md` (Korean) with full documentation
|
|
71
|
-
|
|
72
|
-
### Phase 6a–6b: Suppression Safety — Double-Tap & Mass-Event Logic
|
|
73
|
-
|
|
74
|
-
- Added **Double-Tap suppression**: prevents re-triggering the same file within the cooldown window
|
|
75
|
-
- Added **Mass-Event suppression**: drops bulk filesystem events (threshold: ≥ 5 files / 500ms) to prevent runaway AI calls
|
|
76
|
-
- Added configurable `suppressionCooldownMs` and `massEventThreshold` / `massEventWindowMs`
|
|
77
|
-
- Full E2E safety suite: 9 tests across suppression scenarios — all green
|
|
78
|
-
- Published `docs/06-suppression-safety-audit.md` and `docs/05-release-audit.md`
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## [0.1.0] - 2026-01-01 — Initial prototype
|
|
83
|
-
|
|
84
|
-
- Project scaffold with Bun runtime
|
|
85
|
-
- Basic CLI skeleton and daemon concept
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **afd** are documented in this file.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [1.5.0] - 2026-04-02 — "Trust-Builder"
|
|
11
|
+
|
|
12
|
+
> The immune system now speaks. Three pillars that make afd's defenses visible, self-improving, and smarter.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Hologram L1 — Import-Based Semantic Compression**
|
|
17
|
+
- New optional `contextFile` parameter on `afd_hologram` MCP tool and `/hologram` HTTP endpoint
|
|
18
|
+
- `extractImportedSymbols()` function: regex fast-path parsing of named imports, default imports, and namespace imports from the context file
|
|
19
|
+
- L1 filtering in `generateHologram()`: directly imported symbols receive full type signatures; non-imported exports are reduced to name-only stubs with guide text `// details omitted — read directly if needed`
|
|
20
|
+
- Namespace imports (`import * as X`) trigger full L0 hologram (safe default, no false filtering)
|
|
21
|
+
- Silent fallback to L0 when `contextFile` is missing, unreadable, or yields zero import results
|
|
22
|
+
- Compression target: 85%+ with contextFile (vs ~80% L0 baseline)
|
|
23
|
+
- L1 is MCP/HTTP path only — S.E.A.M hot path remains L0 to protect the 270ms budget
|
|
24
|
+
|
|
25
|
+
- **Antibody Passive Defense — Mistake History Injection**
|
|
26
|
+
- New `mistake_history` SQLite table: `file_path`, `mistake_type`, `description` (max 200 chars), `antibody_id`, `timestamp`
|
|
27
|
+
- Indexes on `file_path` and `timestamp` for sub-millisecond query performance
|
|
28
|
+
- Write-through cache: `mistakeCache: Map<string, MistakeEntry[]>` loaded on daemon startup, updated on every insert
|
|
29
|
+
- Per-file cap of 5 most recent entries enforced at write time
|
|
30
|
+
- 30-day TTL purge on daemon startup (consistent with `telemetry` table pattern)
|
|
31
|
+
- Direct DB insert on auto-heal events (not via HTTP POST): records `mistake_type` from `symptom.patternType` and `description` from `symptom.title`
|
|
32
|
+
- New GET `/mistake-history?file=<path>` HTTP endpoint (returns max 5 entries, most recent first)
|
|
33
|
+
- `pastMistakes` field injected into `afd diagnose --format a2a` output on both the healthy path (proactive warning) and the auto-heal path (reactive)
|
|
34
|
+
- `pastMistakes` is omitted entirely when no history exists (zero token overhead)
|
|
35
|
+
- Path normalization: `file_path` stored with forward slashes (cross-platform safe)
|
|
36
|
+
|
|
37
|
+
- **HUD Defense Counter + Reasons**
|
|
38
|
+
- `/mini-status` endpoint enhanced with `total_defenses: number` and `defense_reasons: string[]` (in-memory only, no DB query — always under 200ms)
|
|
39
|
+
- `defense_reasons` derived from in-memory `state.autoHealLog` (capped at 100 entries), returning up to 3 most recent unique `mistake_type` values
|
|
40
|
+
- Status bar format: `[afd] {N}건 방어 ({reason1}, {reason2}, ...)` when defenses exist; `[afd] ON` when none
|
|
41
|
+
- Existing `healed_count` and `last_healed` fields preserved for backward compatibility
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **Windows path normalization in `assertInsideWorkspace()`**: backslash (`\`) separators in Windows paths are now normalized to forward slashes before workspace boundary checks, fixing false-positive "outside workspace" errors on Windows
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## [1.0.0] - 2026-03-31 — "The Immortal Flow"
|
|
50
|
+
|
|
51
|
+
> [afd] 🛡️ AI agent deleted '.claudeignore' | 🩹 Self-healed in 184ms | Context preserved.
|
|
52
|
+
|
|
53
|
+
**Zero-config immunity for your AI development flow.**
|
|
54
|
+
|
|
55
|
+
### Phase 1–3: Core S.E.A.M Engine & Magic 5 Commands
|
|
56
|
+
|
|
57
|
+
- Introduced the **S.E.A.M Cycle** (Scan → Evaluate → Act → Monitor) as the central execution loop
|
|
58
|
+
- Implemented the **Magic 5 Commands**: `start`, `stop`, `score`, `fix`, `sync`
|
|
59
|
+
- Built `src/core/db.ts`: WAL-mode SQLite for sub-100ms file event persistence
|
|
60
|
+
- Built `src/core/hologram.ts`: AST-based skeleton extraction for token-efficient AI handoff
|
|
61
|
+
- Built `src/core/immune.ts`: Immune tolerance heuristics — suppression logic for noisy events
|
|
62
|
+
- Implemented `src/daemon/server.ts` and `src/daemon/client.ts`: Unix socket IPC for daemon ↔ CLI communication
|
|
63
|
+
- Chokidar-backed file watcher with 100ms debounce in `src/daemon/server.ts`
|
|
64
|
+
|
|
65
|
+
### Phase 4–5: Multilingual UI & Status Line Integration
|
|
66
|
+
|
|
67
|
+
- Added bilingual terminal UI (EN/KO) with chalk-based color output
|
|
68
|
+
- Integrated **Status Line** hook injection for Claude Code, Cursor, and Copilot adapters
|
|
69
|
+
- Added adapter layer (`src/adapters/`) for ecosystem-specific configuration
|
|
70
|
+
- Published `README.md` (English) and `README.ko.md` (Korean) with full documentation
|
|
71
|
+
|
|
72
|
+
### Phase 6a–6b: Suppression Safety — Double-Tap & Mass-Event Logic
|
|
73
|
+
|
|
74
|
+
- Added **Double-Tap suppression**: prevents re-triggering the same file within the cooldown window
|
|
75
|
+
- Added **Mass-Event suppression**: drops bulk filesystem events (threshold: ≥ 5 files / 500ms) to prevent runaway AI calls
|
|
76
|
+
- Added configurable `suppressionCooldownMs` and `massEventThreshold` / `massEventWindowMs`
|
|
77
|
+
- Full E2E safety suite: 9 tests across suppression scenarios — all green
|
|
78
|
+
- Published `docs/06-suppression-safety-audit.md` and `docs/05-release-audit.md`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## [0.1.0] - 2026-01-01 — Initial prototype
|
|
83
|
+
|
|
84
|
+
- Project scaffold with Bun runtime
|
|
85
|
+
- Basic CLI skeleton and daemon concept
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 dotori
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dotori
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README-ko.md
ADDED
|
@@ -0,0 +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">AI 에이전트를 위한 투명한 수호자</h3>
|
|
6
|
+
<p align="center"><strong>자가 치유 환경 + 토큰 84% 절감. AI가 파일을 날려먹어도 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.md">English</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 숫자가 증명한다
|
|
29
|
+
|
|
30
|
+
| 상황 | afd 없이 | afd 있으면 |
|
|
31
|
+
|:-----|:---------|:----------|
|
|
32
|
+
| AI가 `.claudeignore` 삭제 | **30분** 수동 복구 | **0.2초** 자동 치유 |
|
|
33
|
+
| Hook 파일 오염 | 훅 재주입, 세션 재시작 | **백그라운드 무음 수리** |
|
|
34
|
+
| `git checkout`으로 이벤트 50개 폭발 | AI 폭주 시작 | **폭주 억제기 즉시 개입** |
|
|
35
|
+
| 대용량 파일 8개 읽기 (114KB) | **~28,600 토큰** 소비 | **~4,600 토큰** (84% 절약) |
|
|
36
|
+
| 세션 토큰 예산 | 컨텍스트 윈도우 순삭 | **코드베이스 스캔당 ~60,900 토큰 절약** |
|
|
37
|
+
|
|
38
|
+
> `CPU 0.1% 미만` | `RAM ~40MB` | `전체 치유 사이클 270ms` | 있는지도 모르게 동작한다.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 명령어 하나로 끝
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx @dotoricode/afd start
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
끝이다. 데몬 뜨고, 훅 꽂히고, MCP 등록까지 알아서 한다.
|
|
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
|
+
## 문제
|
|
60
|
+
|
|
61
|
+
Claude Code, Cursor, Windsurf — AI 에이전트는 강력하지만 손이 거칠다. `.claudeignore`날리고, `hooks.json` 오염시키고, `.cursorrules` 통째로 밀어버린다. 알아챌 때는 이미 늦었다. 코딩 멈추고, 원인 파악하고, 수동 복구. **30분 증발. 플로우 리셋.**
|
|
62
|
+
|
|
63
|
+
코드 읽을 때마다? 소스 파일 전체를 컨텍스트 윈도우에 그냥 때려박는다. **필요도 없는 함수 본문에 수천 토큰이 증발한다.**
|
|
64
|
+
|
|
65
|
+
## 해결책
|
|
66
|
+
|
|
67
|
+
`afd`는 눈에 안 보이는 백그라운드 데몬이다. 핵심 파일을 항시 감시하고, 오염은 184ms 안에 조용히 되돌린다. AI 에이전트한테는 원본 소스 대신 타입 스켈레톤만 넘긴다 — 필요한 구조 정보를 1/16 비용에. 실수는 눈치채기 전에 처리된다. 일부러 지운 건 그냥 둔다. 설정할 것도 없고, 신경 쓸 것도 없다.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## v1.6.0 주요 업데이트
|
|
72
|
+
|
|
73
|
+
| 기능 | 변경 내용 |
|
|
74
|
+
|:-----|:---------|
|
|
75
|
+
| **Tree-sitter AST 엔진** | TypeScript 컴파일러를 Tree-sitter로 교체 — 다국어 홀로그램 지원 (TS/JS 완전 지원, Python/Go/Rust 폴백) |
|
|
76
|
+
| **실시간 HUD ROI 전광판** | 작업하는 동안 상태 바에서 세션 단위 토큰 절약량을 실시간 확인 |
|
|
77
|
+
| **이벤트 배칭** | 300ms 디바운스 + 중복 제거 — 급격한 파일 변경으로 인한 이벤트 폭풍 차단 |
|
|
78
|
+
| **훅 매니저** | 멀티 오너 오케스트레이션 — 다른 훅 제공자와 깔끔하게 공존 |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 핵심 기능
|
|
83
|
+
|
|
84
|
+
| 기능 | 설명 |
|
|
85
|
+
|:-----|:-----|
|
|
86
|
+
| **S.E.A.M 자가 치유** | 파일 삭제/오염 감지 후 270ms 이내 복구 |
|
|
87
|
+
| **홀로그램 압축** | AI 에이전트에게 MCP로 70-96% 가벼운 파일 스켈레톤 제공 |
|
|
88
|
+
| **스마트 리더** | `afd_read` — 소용량 원본, 대용량 자동 압축, 라인 범위 조회 지원 |
|
|
89
|
+
| **워크스페이스 맵** | `afd://workspace-map` — 전체 파일 트리 + 익스포트 시그니처를 한 번에 |
|
|
90
|
+
| **Import 인식 L1** | 임포트된 심볼만 전체 시그니처 제공 (절약 85%+) |
|
|
91
|
+
| **더블 탭 휴리스틱** | 한 번 삭제 = 치유, 30초 내 재삭제 = 의도로 인식 |
|
|
92
|
+
| **백신 네트워크** | `afd sync`로 학습된 항체를 프로젝트 간 이식 |
|
|
93
|
+
| **자가 진화** | 격리된 실패 사례가 자동으로 예방 규칙이 됨 |
|
|
94
|
+
| **실수 이력** | 파일 편집 전 PreToolUse 훅이 과거 실수를 경고로 주입 |
|
|
95
|
+
| **HUD 카운터** | 상태 바에 방어 횟수 + 토큰 절약량 실시간 표시 |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 토큰 절약 — 실측 데이터
|
|
100
|
+
|
|
101
|
+
홀로그램 시스템은 afd가 제공하는 가장 큰 가치다. 실제 세션에서 측정한 데이터:
|
|
102
|
+
|
|
103
|
+
### 세션 스냅샷
|
|
104
|
+
|
|
105
|
+
| 지표 | 수치 |
|
|
106
|
+
|:-----|:-----|
|
|
107
|
+
| 홀로그램 요청 | 55개 파일 분석 |
|
|
108
|
+
| 대상 파일 총 크기 | ~290 KB (55개, 평균 5.3 KB) |
|
|
109
|
+
| 원본 토큰 비용 | ~72,500 토큰 |
|
|
110
|
+
| 홀로그램 압축 후 | ~11,600 토큰 |
|
|
111
|
+
| **절약된 토큰** | **~60,900 토큰 (84% 감소)** |
|
|
112
|
+
|
|
113
|
+
### 스케일 효과
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
세션 전체 토큰 (ctx ~15%): ~150,000 ████████████████
|
|
117
|
+
홀로그램으로 절약: ~60,900 ████████░░░░░░░░ (세션의 41%)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
ctx 50% 넘어가면 파일 읽기가 토큰을 다 잡아먹는다. 홀로그램 없이 소스 파일 55개 스캔하면 ~72.5K 토큰이 날아간다. 홀로그램으로는 **파일 하나당 원래 비용의 16%** — 반복 읽기가 쌓일수록 격차가 벌어진다.
|
|
121
|
+
|
|
122
|
+
### 3단계 토큰 다이어트
|
|
123
|
+
|
|
124
|
+
| 레이어 | 도구 | 절약률 | 방식 |
|
|
125
|
+
|:-------|:-----|:-------|:-----|
|
|
126
|
+
| **L0 홀로그램** | `afd_hologram` | 80%+ | 함수 본문 제거, 타입 시그니처만 유지 |
|
|
127
|
+
| **L1 홀로그램** | `afd_hologram` + `contextFile` | 85%+ | 임포트된 심볼만 전체 시그니처 제공 |
|
|
128
|
+
| **스마트 리더** | `afd_read` | 자동 | 10KB 미만 원본, 10KB 이상 자동 홀로그램 |
|
|
129
|
+
| **워크스페이스 맵** | `afd://workspace-map` | N/A | 전체 프로젝트 구조를 한 번에 |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
<details>
|
|
134
|
+
<summary><b>S.E.A.M 동작 원리 (내부 구조)</b></summary>
|
|
135
|
+
|
|
136
|
+
모든 파일 이벤트는 네 단계를 거친다:
|
|
137
|
+
|
|
138
|
+
```mermaid
|
|
139
|
+
graph LR
|
|
140
|
+
S["Sense<br/><i>파일 변경 감지</i>"] --> E["Extract<br/><i>증상 분석</i>"]
|
|
141
|
+
E --> A["Adapt<br/><i>항체 선택</i>"]
|
|
142
|
+
A --> M["Mutate<br/><i>JSON-Patch 적용</i>"]
|
|
143
|
+
M -->|"학습"| 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
|
+
| 단계 | 동작 | 속도 |
|
|
151
|
+
|:-----|:-----|:-----|
|
|
152
|
+
| **Sense** | Chokidar가 `add`, `change`, `unlink` 이벤트 감지 | < 10ms |
|
|
153
|
+
| **Extract** | 홀로그램(타입 스켈레톤) 생성 + 상태 검사 | < 5ms |
|
|
154
|
+
| **Adapt** | 증상에 맞는 항체 매칭, 오염 파일 격리 | < 1ms |
|
|
155
|
+
| **Mutate** | RFC 6902 JSON-Patch로 파일 복구 | < 25ms |
|
|
156
|
+
|
|
157
|
+
> 전체 사이클: 파일 삭제부터 완전 복구까지 **270ms 미만**.
|
|
158
|
+
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 명령어
|
|
164
|
+
|
|
165
|
+
| 명령어 | 역할 |
|
|
166
|
+
|:-------|:-----|
|
|
167
|
+
| `afd start` | 데몬 시작 + 스마트 디스커버리 + 훅 주입 + MCP 등록 |
|
|
168
|
+
| `afd stop` | 교대 요약 리포트 + 정상 종료 (`--clean`으로 훅/MCP 제거) |
|
|
169
|
+
| `afd score` | 진화 및 홀로그램 메트릭 포함 상태 대시보드 |
|
|
170
|
+
| `afd fix` | 홀로그램 컨텍스트 포함 증상 진단 + 항체 학습 |
|
|
171
|
+
| `afd sync` | 백신 페이로드 내보내기/가져오기 (`--push`, `--pull`, `--remote <url>`) |
|
|
172
|
+
| `afd restart` | 정지 + 시작 원커맨드 |
|
|
173
|
+
| `afd status` | 빠른 상태 확인 — 데몬, 훅, MCP, 방어 이력 |
|
|
174
|
+
| `afd doctor` | 자동 수정 권고 포함 종합 상태 분석 |
|
|
175
|
+
| `afd evolution` | 격리 실패 분석 + 예방 규칙 생성 |
|
|
176
|
+
| `afd mcp install` | 프로젝트 + 글로벌 설정에 MCP 서버 등록 |
|
|
177
|
+
| `afd vaccine` | 커뮤니티 항체 목록 조회, 검색, 설치, 배포 |
|
|
178
|
+
| `afd lang` | 표시 언어 전환 (`afd lang ko` / `afd lang en`) |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
<details>
|
|
183
|
+
<summary><b>고급 기능</b></summary>
|
|
184
|
+
|
|
185
|
+
### 더블 탭 휴리스틱
|
|
186
|
+
|
|
187
|
+
`afd`는 **실수**와 **의도**를 구분한다:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
$ rm .claudeignore # 첫 번째 탭 -> afd가 무음으로 치유
|
|
191
|
+
$ rm .claudeignore # 30초 내 재삭제 -> "의도한 것이군."
|
|
192
|
+
[afd] 항체 IMM-001 휴면 전환. 더블 탭 감지. 개입 중단.
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
| 시나리오 | 대응 |
|
|
196
|
+
|:---------|:-----|
|
|
197
|
+
| 단일 삭제 (실수) | 자동 치유 + 첫 탭 기록 |
|
|
198
|
+
| 30초 내 재삭제 (의도) | 항체 휴면 전환, 삭제 존중 |
|
|
199
|
+
| 1초 내 3회 이상 삭제 (git checkout) | 대규모 이벤트 감지, 전체 억제 일시 해제 |
|
|
200
|
+
|
|
201
|
+
### 백신 네트워크
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
afd sync # .afd/global-vaccine-payload.json으로 내보내기
|
|
205
|
+
afd sync --push # 원격으로 백신 푸시
|
|
206
|
+
afd sync --pull # 원격에서 백신 풀
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
절대 경로도 시크릿도 없이 깔끔하게 정제돼 있어서 어디든 갖다 쓸 수 있다.
|
|
210
|
+
|
|
211
|
+
### 자가 진화
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
afd evolution
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
격리된 실패 사례를 분석해 `afd-lessons.md`에 예방 규칙을 작성한다. AI 에이전트는 면역 핵심 파일 편집 전 이 파일을 참조 — 과거의 실패가 미래의 방패가 된다.
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## MCP 설정
|
|
224
|
+
|
|
225
|
+
`afd`는 4개의 MCP 도구와 1개의 리소스를 제공한다:
|
|
226
|
+
|
|
227
|
+
| MCP 도구 | 역할 |
|
|
228
|
+
|:---------|:-----|
|
|
229
|
+
| `afd_read` | 스마트 파일 리더 — 소용량 원본, 대용량 자동 홀로그램, 라인 범위 지원 |
|
|
230
|
+
| `afd_hologram` | TS/JS 파일의 토큰 효율적인 타입 스켈레톤 (80%+ 절약) |
|
|
231
|
+
| `afd_diagnose` | 증상 및 홀로그램 컨텍스트 포함 상태 진단 |
|
|
232
|
+
| `afd_score` | 런타임 통계: 가동시간, 치유 횟수, 홀로그램 절약량 |
|
|
233
|
+
|
|
234
|
+
| MCP 리소스 | 역할 |
|
|
235
|
+
|:-----------|:-----|
|
|
236
|
+
| `afd://workspace-map` | 익스포트 시그니처 포함 전체 파일 트리를 한 번에 |
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
afd mcp install # .mcp.json + ~/.claude.json에 등록
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
<details>
|
|
245
|
+
<summary><b>기술 스택</b></summary>
|
|
246
|
+
|
|
247
|
+
| 레이어 | 기술 | 이유 |
|
|
248
|
+
|:-------|:-----|:-----|
|
|
249
|
+
| 런타임 | **Bun** | 네이티브 TypeScript, 빠른 SQLite, 단일 바이너리 |
|
|
250
|
+
| 데이터베이스 | **Bun SQLite (WAL)** | 읽기 0.29ms, 쓰기 24ms, 크래시 안전 |
|
|
251
|
+
| 파싱 | **Tree-sitter** | 다국어 AST — TS, JS, Python, Go, Rust |
|
|
252
|
+
| 감시 | **Chokidar** | 크로스플랫폼, 검증된 파일 와처 |
|
|
253
|
+
| 패칭 | **RFC 6902 JSON-Patch** | 결정론적, 조합 가능한 파일 변이 |
|
|
254
|
+
| CLI | **Commander.js** | 표준, 예측 가능한 명령어 파싱 |
|
|
255
|
+
|
|
256
|
+
</details>
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 설치
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# 가장 빠른 방법 (설치 불필요)
|
|
264
|
+
npx @dotoricode/afd start
|
|
265
|
+
|
|
266
|
+
# Bun으로 설치 (개발 환경 권장)
|
|
267
|
+
bun install
|
|
268
|
+
bun link
|
|
269
|
+
afd start
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### 요구사항
|
|
273
|
+
|
|
274
|
+
- **Bun** >= 1.0
|
|
275
|
+
- **OS**: Windows, macOS, Linux
|
|
276
|
+
- **대상**: Claude Code, Cursor, Windsurf, Codex (에코시스템 자동 감지)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 라이선스
|
|
281
|
+
|
|
282
|
+
MIT
|