autonomous-flow-daemon 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/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
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.0.0] - 2026-03-31 β€” "The Immortal Flow"
11
+
12
+ > [afd] πŸ›‘οΈ AI agent deleted '.claudeignore' | 🩹 Self-healed in 184ms | Context preserved.
13
+
14
+ **Zero-config immunity for your AI development flow.**
15
+
16
+ ### Phase 1–3: Core S.E.A.M Engine & Magic 5 Commands
17
+
18
+ - Introduced the **S.E.A.M Cycle** (Scan β†’ Evaluate β†’ Act β†’ Monitor) as the central execution loop
19
+ - Implemented the **Magic 5 Commands**: `start`, `stop`, `score`, `fix`, `sync`
20
+ - Built `src/core/db.ts`: WAL-mode SQLite for sub-100ms file event persistence
21
+ - Built `src/core/hologram.ts`: AST-based skeleton extraction for token-efficient AI handoff
22
+ - Built `src/core/immune.ts`: Immune tolerance heuristics β€” suppression logic for noisy events
23
+ - Implemented `src/daemon/server.ts` and `src/daemon/client.ts`: Unix socket IPC for daemon ↔ CLI communication
24
+ - Chokidar-backed file watcher with 100ms debounce in `src/daemon/server.ts`
25
+
26
+ ### Phase 4–5: Multilingual UI & Status Line Integration
27
+
28
+ - Added bilingual terminal UI (EN/KO) with chalk-based color output
29
+ - Integrated **Status Line** hook injection for Claude Code, Cursor, and Copilot adapters
30
+ - Added adapter layer (`src/adapters/`) for ecosystem-specific configuration
31
+ - Published `README.md` (English) and `README.ko.md` (Korean) with full documentation
32
+
33
+ ### Phase 6a–6b: Suppression Safety β€” Double-Tap & Mass-Event Logic
34
+
35
+ - Added **Double-Tap suppression**: prevents re-triggering the same file within the cooldown window
36
+ - Added **Mass-Event suppression**: drops bulk filesystem events (threshold: β‰₯ 5 files / 500ms) to prevent runaway AI calls
37
+ - Added configurable `suppressionCooldownMs` and `massEventThreshold` / `massEventWindowMs`
38
+ - Full E2E safety suite: 9 tests across suppression scenarios β€” all green
39
+ - Published `docs/06-suppression-safety-audit.md` and `docs/05-release-audit.md`
40
+
41
+ ---
42
+
43
+ ## [0.1.0] - 2026-01-01 β€” Initial prototype
44
+
45
+ - Project scaffold with Bun runtime
46
+ - Basic CLI skeleton and daemon concept
package/LICENSE ADDED
@@ -0,0 +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.
package/README.ko.md ADDED
@@ -0,0 +1,249 @@
1
+ <p align="center">
2
+ <img src="https://capsule-render.vercel.app/api?type=soft&color=auto&height=200&section=header&text=afd&fontSize=90" alt="afd" />
3
+ </p>
4
+
5
+ <h3 align="center">Autonomous Flow Daemon (afd)</h3>
6
+ <p align="center"><strong>AIκ°€ 슀슀둜 κ³ μΉ˜λŠ” 개발 ν™˜κ²½. λ³΅κ΅¬κΉŒμ§€ 단 0.2초.</strong></p>
7
+
8
+ <p align="center">
9
+ <img src="https://img.shields.io/badge/version-1.0.0-blue?style=flat-square" alt="version" />
10
+ <img src="https://img.shields.io/badge/runtime-Bun-f472b6?style=flat-square&logo=bun" alt="Bun" />
11
+ <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT" />
12
+ <img src="https://img.shields.io/badge/built%20for-Claude%20Code-7c3aed?style=flat-square" alt="Claude Code" />
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="README.md">English</a>
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## μ™œ afd인가?
22
+
23
+ > [afd] πŸ›‘οΈ AIκ°€ '.claudeignore'λ₯Ό μ‚­μ œν–ˆμŠ΅λ‹ˆλ‹€ | 🩹 184ms λ§Œμ— μžκ°€ 볡ꡬ μ™„λ£Œ | μ»¨ν…μŠ€νŠΈ 보쑴됨.
24
+
25
+ 당신은 μ§€κΈˆ λͺ°μž…μ˜ 정점에 μžˆμŠ΅λ‹ˆλ‹€. AI μ—μ΄μ „νŠΈκ°€ μ‹€μˆ˜λ‘œ μ„€μ • νŒŒμΌμ„ μ‚­μ œν•˜κ±°λ‚˜, ν›… νŒŒμΌμ„ λ§κ°€λœ¨λ¦½λ‹ˆλ‹€. `afd` μ—†μ΄λŠ” μž‘μ—…μ„ λ©ˆμΆ”κ³ , 원인을 μ§„λ‹¨ν•˜κ³ , 직접 고쳐야 ν•©λ‹ˆλ‹€: **30뢄이 λ‚ μ•„κ°‘λ‹ˆλ‹€**.
26
+
27
+ `afd`κ°€ μžˆλ‹€λ©΄, 데λͺ¬μ΄ 10ms λ§Œμ— 이상을 κ°μ§€ν•˜κ³ , 184ms μ•ˆμ— 볡ꡬλ₯Ό μ™„λ£Œν•©λ‹ˆλ‹€. **당신은 아무것도 λͺ°λžμŠ΅λ‹ˆλ‹€.**
28
+
29
+ | 상황 | afd 없을 λ•Œ | afd μžˆμ„ λ•Œ |
30
+ |:-----|:------------|:------------|
31
+ | AIκ°€ `.claudeignore` μ‚­μ œ | 30λΆ„ μˆ˜λ™ 볡ꡬ | **0.2초 μžλ™ 치유** |
32
+ | ν›… 파일 손상 | ν›… μž¬μ£Όμž…, μ„Έμ…˜ μž¬μ‹œμž‘ | **λ°±κ·ΈλΌμš΄λ“œ μžλ™ 볡ꡬ** |
33
+ | `git checkout`으둜 파일 50개 λ™μ‹œ λ³€κ²½ | AIκ°€ 폭주 | **λŒ€κ·œλͺ¨ 이벀트 μ–΅μ œκΈ° μž‘λ™** |
34
+ | μ‹ κ·œ νŒ€μ›, ν™˜κ²½ μ„€μ • μ—†μŒ | κ΅¬μ „μœΌλ‘œ 전달 | **`afd sync`둜 μ¦‰μ‹œ λ°±μ‹  μ ‘μ’…** |
35
+
36
+ ---
37
+
38
+ ## πŸš€ λͺ…λ Ήμ–΄ ν•œ μ€„λ‘œ λλ‚˜λŠ” κ²½ν—˜
39
+
40
+ > **"더 μ΄μƒμ˜ μ„€μ • μ‚½μ§ˆμ€ μ—†μŠ΅λ‹ˆλ‹€. μ™„μ „ν•œ λ°©μ–΄ ν™˜κ²½μ„ κ΅¬μΆ•ν•˜μ„Έμš”."**
41
+
42
+ ```bash
43
+ npx @dotoricode/afd start
44
+ ```
45
+
46
+ λ‘œμ»¬μ— μ„€μΉ˜ν•˜μ—¬ μ‚¬μš©ν•˜λ €λ©΄:
47
+
48
+ ```bash
49
+ bun link && afd start
50
+ ```
51
+
52
+ 이게 μ „λΆ€μž…λ‹ˆλ‹€. λ‚˜λ¨Έμ§€λŠ” `afd`κ°€ μ•Œμ•„μ„œ μ²˜λ¦¬ν•©λ‹ˆλ‹€:
53
+
54
+ - **μžλ™ ν›…(Hook) μ£Όμž…** β€” Claude Code의 `PreToolUse` 훅을 μžλ™μœΌλ‘œ μ„€μΉ˜ν•©λ‹ˆλ‹€. 더 이상 `.json` νŒŒμΌμ„ 직접 μˆ˜μ •ν•˜λ©° κ³ μƒν•˜μ§€ λ§ˆμ„Έμš”.
55
+ - **μ΄ˆκ³ μ† μ‹€μ‹œκ°„ κ°μ‹œ** β€” `.claude/`, `CLAUDE.md`, `.cursorrules` λ“± 핡심 νŒŒμΌμ„ 10ms λ‹¨μœ„λ‘œ λͺ¨λ‹ˆν„°λ§ν•©λ‹ˆλ‹€.
56
+ - **λ°°κ²½ 자율 치유** β€” 파일이 μ‚­μ œλ˜κ±°λ‚˜ μ†μƒλ˜λ©΄ **S.E.A.M 사이클**이 쑰용히 λ³΅κ΅¬ν•©λ‹ˆλ‹€. μ‚¬μš©μžκ°€ λˆˆμΉ˜μ±„κΈ°λ„ 전에 λͺ¨λ“  상황은 μ’…λ£Œλ©λ‹ˆλ‹€.
57
+
58
+ ```
59
+ $ afd start
60
+ πŸ›‘οΈ afd 데λͺ¬ μ‹œμž‘ (pid 4812, port 52413)
61
+ βœ… .claude/hooks.json에 κ°μ‹œ ν›… μ£Όμž… μ™„λ£Œ
62
+ πŸ‘€ κ°μ‹œ 쀑: .claude/, CLAUDE.md, .cursorrules
63
+ ✨ μ€€λΉ„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
64
+ ```
65
+
66
+ > `afd start`λ₯Ό 치고 λ‚˜λ©΄ κ·Έλƒ₯ μžŠμ–΄λ²„λ¦¬μ„Έμš”. 그것이 μš°λ¦¬κ°€ μΆ”κ΅¬ν•˜λŠ” 졜고의 UXμž…λ‹ˆλ‹€.
67
+
68
+ ---
69
+
70
+ ## 🧠 μ§€λŠ₯ν˜• 치유 μ—”μ§„: S.E.A.M 사이클
71
+
72
+ `afd`의 핡심 λ‘œμ§μž…λ‹ˆλ‹€. λͺ¨λ“  파일 λ³€ν™”λŠ” λ‹€μŒμ˜ 4단계λ₯Ό 거쳐 μ¦‰μ‹œ μ •μ œλ©λ‹ˆλ‹€:
73
+
74
+ ```mermaid
75
+ graph LR
76
+ S["Sense<br/><i>λ³€κ²½ 감지</i>"] --> E["Extract<br/><i>증상 뢄석</i>"]
77
+ E --> A["Adapt<br/><i>항체 선택</i>"]
78
+ A --> M["Mutate<br/><i>치유/볡ꡬ</i>"]
79
+ M -->|"μžκ°€ ν•™μŠ΅"| S
80
+ style S fill:#3b82f6,color:#fff,stroke:none
81
+ style E fill:#f59e0b,color:#fff,stroke:none
82
+ style A fill:#10b981,color:#fff,stroke:none
83
+ style M fill:#ef4444,color:#fff,stroke:none
84
+ ```
85
+
86
+ | 단계 | μ£Όμš” λ™μž‘ | 처리 속도 |
87
+ |:------|:-----|:-----|
88
+ | **Sense** | Chokidar μ™€μ²˜κ°€ 파일의 생성, λ³€κ²½, μ‚­μ œλ₯Ό 즉각 감지 | < 10ms |
89
+ | **Extract** | λ©΄μ—­ 엔진이 λ‚΄μž₯된 3단계 건강 κ²€μ§„ μ‹€ν–‰ (IMM-001..003) | < 5ms |
90
+ | **Adapt** | SQLite(WAL λͺ¨λ“œ) DBμ—μ„œ 졜적의 볡ꡬ 항체(Antibody) λ§€μΉ­ | < 1ms |
91
+ | **Mutate** | RFC 6902 JSON-Patch 기술둜 원본 νŒŒμΌμ„ μ™„λ²½νžˆ 볡원 | < 25ms |
92
+
93
+ > **μ΅œμ’… μ„±μ ν‘œ:** 파일 μ‚­μ œ 감지뢀터 볡ꡬ μ™„λ£ŒκΉŒμ§€ **270ms 미만**.
94
+
95
+ ---
96
+
97
+ ## πŸ› οΈ Magic 5 β€” 핡심 λͺ…λ Ήμ–΄
98
+
99
+ λ³΅μž‘ν•œ 건 λΉΌκ³ , κΌ­ ν•„μš”ν•œ 5κ°€μ§€λ§Œ λ‹΄μ•˜μŠ΅λ‹ˆλ‹€.
100
+
101
+ | λͺ…λ Ήμ–΄ | μ—­ν•  | 핡심 μ§€λŠ₯ |
102
+ |:-------|:-----|:----------|
103
+ | `afd start` | **μ‹œλ™** | λ°±κ·ΈλΌμš΄λ“œ 데λͺ¬ 가동 및 μžλ™ ν›… μ£Όμž… |
104
+ | `afd fix` | **수술** | ν˜„μž¬ ν”„λ‘œμ νŠΈ 진단 및 μƒˆλ‘œμš΄ 항체 ν•™μŠ΅ |
105
+ | `afd score` | **λŒ€μ‹œλ³΄λ“œ** | ν”„λ‘œμ νŠΈ 건강 점수 및 치유 톡계 확인 |
106
+ | `afd sync` | **μ „νŒŒ** | ν•™μŠ΅λœ 항체λ₯Ό λ°±μ‹  파일둜 μΆ”μΆœ (νŒ€ 곡유용) |
107
+ | `afd stop` | **μ’…λ£Œ** | 데λͺ¬μ„ μ•ˆμ „ν•˜κ²Œ 끄고 ν”„λ‘œμ„ΈμŠ€ 정리 |
108
+
109
+ ---
110
+
111
+ ## πŸ“Š μ‹€μ‹œκ°„ λŒ€μ‹œλ³΄λ“œ: `afd score`
112
+
113
+ ```
114
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
115
+ β”‚ afd score β€” ν”„λ‘œμ νŠΈ 건강 κ²€μ§„ 리포트 β”‚
116
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
117
+ β”‚ μ—μ½”μ‹œμŠ€ν…œ : Claude Code β”‚
118
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
119
+ β”‚ 가동 μ‹œκ°„ : 1μ‹œκ°„ 23λΆ„ β”‚
120
+ β”‚ κ°μ§€λœ 이벀트 : 156건 β”‚
121
+ β”‚ 보호 쀑인 파일: 8개 β”‚
122
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
123
+ β”‚ λ©΄μ—­ μ‹œμŠ€ν…œ μƒνƒœ (Immune System) β”‚
124
+ β”‚ ────────────────────────────── β”‚
125
+ β”‚ 보유 항체 : 7개 β”‚
126
+ β”‚ λ°©μ–΄ 레벨 : 철톡 λ³΄μ•ˆ (Fortified) β”‚
127
+ β”‚ μžλ™ 치유 : 3건 (λ°±κ·ΈλΌμš΄λ“œ 처리) β”‚
128
+ β”‚ 졜근 치유 : IMM-003 (.claudeignore 볡ꡬ) β”‚
129
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
130
+ β”‚ μ–΅μ œ μ•ˆμ „μž₯치 (Safety) β”‚
131
+ β”‚ ────────────────────────────── β”‚
132
+ β”‚ λŒ€κ·œλͺ¨ 이벀트 λ¬΄μ‹œ: 2건 (git checkout λ“±) β”‚
133
+ β”‚ μ˜λ„μ  μ‚­μ œ ν—ˆμš© : 0건 (Dormant μ „ν™˜) β”‚
134
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
135
+ β”‚ Hologram μ ˆμ•½ : 토큰 μ†Œλͺ¨λŸ‰ 84% κ°μ†Œ β”‚
136
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
137
+ ```
138
+
139
+ ---
140
+
141
+ ## πŸ’Ž κ³ λ„λ‘œ μ„€κ³„λœ μ•ˆμ „ μž₯치
142
+
143
+ ### Double-Tap νœ΄λ¦¬μŠ€ν‹± (μ˜λ„μ™€ μ‹€μˆ˜μ˜ ꡬ뢄)
144
+
145
+ `afd`λŠ” λ°”λ³΄μ²˜λŸΌ 무쑰건 λ˜μ‚΄λ¦¬μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. μ‚¬μš©μžμ˜ **μ§„μ§œ μ˜λ„**λ₯Ό μ½μŠ΅λ‹ˆλ‹€:
146
+
147
+ ```bash
148
+ $rm .claudeignore # 1μ°¨ μ‚­μ œ: "μ‹€μˆ˜μΈκ°€ 보ꡰ." -> μ¦‰μ‹œ 볡ꡬ$ rm .claudeignore # 60초 λ‚΄ μž¬μ‚­μ œ: "μ§„μ§œ μ§€μš°κ³  μ‹Άκ΅¬λ‚˜?"
149
+ πŸ›‘οΈ [afd] μ‚¬μš©μž μ˜λ„ 확인. 항체 IMM-001 휴면 μ „ν™˜. μ‚­μ œλ₯Ό μ‘΄μ€‘ν•©λ‹ˆλ‹€.
150
+ ```
151
+
152
+ - **μ‹€μˆ˜ λ°©μ–΄:** ν•œ 번의 μ‚­μ œλŠ” 0.2초 λ§Œμ— μ¦‰μ‹œ λ³΅κ΅¬ν•©λ‹ˆλ‹€.
153
+ - **μ˜λ„ 쑴쀑:** 1λΆ„ 내에 같은 νŒŒμΌμ„ 또 μ§€μš°λ©΄ μ‚¬μš©μžμ˜ ν™•κ³ ν•œ μ˜μ§€λ‘œ νŒλ‹¨ν•΄ 볡ꡬλ₯Ό 멈μΆ₯λ‹ˆλ‹€.
154
+ - **Git 쇼크 λ°©μ§€:** `git checkout`처럼 μˆ˜λ§Žμ€ 파일이 ν•œκΊΌλ²ˆμ— λ°”λ€ŒλŠ” 상황(1초 λ‚΄ 3개 이상)은 'λŒ€κ·œλͺ¨ 이벀트'둜 μžλ™ μΈμ‹ν•˜μ—¬ κ³Όλ„ν•œ 치유 λ™μž‘μ„ 멈μΆ₯λ‹ˆλ‹€.
155
+
156
+ ### λ°±μ‹  λ„€νŠΈμ›Œν¬ (νŒ€ μ „νŒŒ)
157
+
158
+ λ‚˜λ§Œ λ˜‘λ˜‘ν•΄μ§€λŠ” 게 μ•„λ‹™λ‹ˆλ‹€. λ‚΄κ°€ λ°œκ²¬ν•œ 해결책을 νŒ€μ› λͺ¨λ‘μ—κ²Œ μ „νŒŒν•˜μ„Έμš”:
159
+
160
+ ```bash
161
+ afd sync
162
+ # β†’ .afd/global-vaccine-payload.json 생성
163
+ ```
164
+ 이 νŒŒμΌμ€ μ •μ œλ˜μ–΄ μžˆμ–΄ κΈ°λ°€ 정보가 μ„žμ΄μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ‹€λ₯Έ ν”„λ‘œμ νŠΈμ— λ„£κΈ°λ§Œ ν•˜λ©΄ `afd`κ°€ ν•΄λ‹Ή ν”„λ‘œμ νŠΈμ˜ λ©΄μ—­λ ₯을 μ¦‰μ‹œ μ΄μ‹λ°›μŠ΅λ‹ˆλ‹€.
165
+
166
+ ### Hologram μΆ”μΆœ (토큰 λ‹€μ΄μ–΄νŠΈ)
167
+
168
+ AI μ—μ΄μ „νŠΈκ°€ 파일 λ‚΄μš©μ„ μš”κ΅¬ν•  λ•Œ, `afd`λŠ” **λΌˆλŒ€λ§Œ 남긴 μ΄ˆκ²½λŸ‰ μš”μ•½λ³Έ**을 μ œκ³΅ν•©λ‹ˆλ‹€. 주석과 κΈ΄ ν•¨μˆ˜ 본문은 κ±·μ–΄λ‚΄κ³  νƒ€μž… μ •μ˜μ™€ ꡬ쑰만 μ „λ‹¬ν•˜μ—¬ **토큰 λΉ„μš©μ„ 80% 이상 절감**ν•©λ‹ˆλ‹€.
169
+
170
+ ---
171
+
172
+ ## πŸ”Œ Plugin / MCP μ„€μ •
173
+
174
+ `afd`λ₯Ό **Model Context Protocol (MCP) μ„œλ²„**둜 λ“±λ‘ν•˜λ©΄ Claude Codeκ°€ μ‹œμž‘λ  λ•Œ 데λͺ¬μ΄ μžλ™μœΌλ‘œ μ‹€ν–‰λ©λ‹ˆλ‹€.
175
+
176
+ ### μžλ™ μ„€μ • (ꢌμž₯)
177
+
178
+ Claude Code MCP μ„€μ •(`~/.claude/mcp.json` λ˜λŠ” ν”„λ‘œμ νŠΈ `.mcp.json`)에 μΆ”κ°€ν•˜μ„Έμš”:
179
+
180
+ ```json
181
+ {
182
+ "mcpServers": {
183
+ "afd": {
184
+ "command": "bun",
185
+ "args": ["run", "src/cli.ts", "start"]
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ λ˜λŠ” ν¬ν•¨λœ λ§€λ‹ˆνŽ˜μŠ€νŠΈλ₯Ό λ°”λ‘œ λ³΅μ‚¬ν•˜μ„Έμš”:
192
+
193
+ ```bash
194
+ cp mcp-config.json .mcp.json
195
+ ```
196
+
197
+ ### μˆ˜λ™ μ‹€ν–‰
198
+
199
+ ```bash
200
+ afd start # λ°±κ·ΈλΌμš΄λ“œ 데λͺ¬ μ‹œμž‘ 및 ν›… μžλ™ μ£Όμž…
201
+ ```
202
+
203
+ 등둝 ν›„ Claude Code μƒνƒœ ν‘œμ‹œμ€„μ—μ„œ μ‹€μ‹œκ°„μœΌλ‘œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€:
204
+
205
+ ```
206
+ πŸ›‘οΈ afd: ON | 🩹 3 Healed | last: IMM-003
207
+ ```
208
+
209
+ ---
210
+
211
+ ## πŸ› οΈ 기술 μŠ€νƒ
212
+
213
+ - **Runtime**: **Bun** β€” μ΄ˆκ³ μ† μ‹€ν–‰ 속도와 λ„€μ΄ν‹°λΈŒ SQLite 지원.
214
+ - **Database**: **SQLite (WAL)** β€” 읽기 0.29ms의 압도적 μ„±λŠ₯κ³Ό ν¬λž˜μ‹œ μ•ˆμ „μ„±.
215
+ - **Patching**: **RFC 6902 JSON-Patch** β€” 파일의 λ―Έμ„Έν•œ λ³€ν™”λ₯Ό κ°€μž₯ μ •κ΅ν•˜κ²Œ λ³΅μ›ν•˜λŠ” 기술.
216
+
217
+ ---
218
+
219
+ ## πŸ“¦ μ„€μΉ˜ 및 μ‹œμž‘ν•˜κΈ°
220
+
221
+ ```bash
222
+ # Bun μ‚¬μš© ꢌμž₯
223
+ bun install
224
+ bun link
225
+ afd start
226
+
227
+ # μ„€μΉ˜ 없이 λ°”λ‘œ μ‹€ν–‰ν•˜κΈ° (npx)
228
+ npx @dotoricode/afd start
229
+ ```
230
+
231
+ ### ν™˜κ²½ μš”κ΅¬ 사항
232
+ - **Bun** >= 1.0
233
+ - **OS**: Windows, macOS, Linux 지원
234
+ - **ν˜Έν™˜ ν™˜κ²½**: Claude Code, Cursor λ“± (μƒνƒœκ³„ μžλ™ 감지)
235
+
236
+ ---
237
+
238
+ ## πŸ›‘οΈ μ•ˆλ„κ°μ„ μ£ΌλŠ” UX
239
+
240
+ `afd`의 λͺ©ν‘œλŠ” λͺ…ν™•ν•©λ‹ˆλ‹€.
241
+
242
+ > **"μ„€μ • 파일 ν•˜λ‚˜ λ‚ μ•„κ°€μ„œ 30뢄을 ν—ˆλΉ„ν•˜λŠ” 그런 날은 이제 λλ‚¬μŠ΅λ‹ˆλ‹€."**
243
+
244
+ 당신은 μ½”λ“œμ—λ§Œ μ§‘μ€‘ν•˜μ„Έμš”. ν”„λ‘œμ νŠΈ ν™˜κ²½μ˜ 건강은 `afd`κ°€ 24μ‹œκ°„ λ°±κ·ΈλΌμš΄λ“œμ—μ„œ μ§€μΌœλ“œλ¦½λ‹ˆλ‹€.
245
+
246
+ ---
247
+
248
+ ## λΌμ΄μ„ μŠ€
249
+ MIT
package/README.md ADDED
@@ -0,0 +1,281 @@
1
+ <p align="center">
2
+ <img src="https://capsule-render.vercel.app/api?type=soft&color=auto&height=200&section=header&text=afd&fontSize=90" alt="afd" />
3
+ </p>
4
+
5
+ <h3 align="center">The Autonomous Flow Daemon</h3>
6
+ <p align="center"><strong>Self-healing AI development environments in < 270ms.</strong></p>
7
+
8
+ <p align="center">
9
+ <img src="https://img.shields.io/badge/version-1.0.0-blue?style=flat-square" alt="version" />
10
+ <img src="https://img.shields.io/badge/runtime-Bun-f472b6?style=flat-square&logo=bun" alt="Bun" />
11
+ <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT" />
12
+ <img src="https://img.shields.io/badge/built%20for-Claude%20Code-7c3aed?style=flat-square" alt="Claude Code" />
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="README.ko.md">ν•œκ΅­μ–΄</a>
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## Why afd?
22
+
23
+ > [afd] πŸ›‘οΈ AI agent deleted '.claudeignore' | 🩹 Self-healed in 184ms | Context preserved.
24
+
25
+ You're deep in flow. Your AI agent makes a wrong move β€” deletes a config, corrupts a hook file, wipes a `.cursorrules`. Without `afd`, you stop everything, diagnose the breakage, manually fix it: **30 minutes gone**.
26
+
27
+ With `afd`, the daemon noticed in 10ms, restored the file in 184ms, and logged it silently. **You never even saw it happen.**
28
+
29
+ | Situation | Without afd | With afd |
30
+ |:----------|:------------|:---------|
31
+ | AI deletes `.claudeignore` | 30 min manual fix | **0.2s auto-heal** |
32
+ | Hook file corrupted | Re-inject hooks, restart session | **Silent background repair** |
33
+ | `git checkout` triggers 50 file events | AI goes haywire | **Mass-event suppressor kicks in** |
34
+ | New team member, missing context | Tribal knowledge required | **`afd sync` vaccines the setup** |
35
+
36
+ ---
37
+
38
+ ## The One-Command Experience
39
+
40
+ > **Zero-Config. Total Protection.**
41
+
42
+ ```bash
43
+ npx @dotoricode/afd start
44
+ ```
45
+
46
+ Or install locally:
47
+
48
+ ```bash
49
+ bun link && afd start
50
+ ```
51
+
52
+ That's it. One command. `afd` takes over from here:
53
+
54
+ - **Auto-Injection** β€” Installs `PreToolUse` hooks into Claude Code silently. No manual config editing.
55
+ - **Sense (Watcher)** β€” 10ms real-time monitoring of critical configs: `.claude/`, `CLAUDE.md`, `.cursorrules`.
56
+ - **Auto-Heal** β€” Silent background repair of missing or corrupted files using the **S.E.A.M cycle**. You won't even notice it happened.
57
+
58
+ ```
59
+ $ afd start
60
+ afd daemon started (pid 4812, port 52413)
61
+ Hook injected into .claude/hooks.json
62
+ Watching: .claude/, CLAUDE.md, .cursorrules
63
+ Ready.
64
+ ```
65
+
66
+ > You type `afd start`. Then you forget about it. That's the entire UX.
67
+
68
+ ---
69
+
70
+ ## The S.E.A.M Cycle
71
+
72
+ The intelligence inside `afd`. Every file event flows through four stages:
73
+
74
+ ```mermaid
75
+ graph LR
76
+ S["Sense<br/><i>File Change Detected</i>"] --> E["Extract<br/><i>Detect Symptom</i>"]
77
+ E --> A["Adapt<br/><i>Select Antibody</i>"]
78
+ A --> M["Mutate<br/><i>Apply JSON-Patch</i>"]
79
+ M -->|"Learn"| S
80
+ style S fill:#3b82f6,color:#fff,stroke:none
81
+ style E fill:#f59e0b,color:#fff,stroke:none
82
+ style A fill:#10b981,color:#fff,stroke:none
83
+ style M fill:#ef4444,color:#fff,stroke:none
84
+ ```
85
+
86
+ | Stage | What Happens | Speed |
87
+ |:------|:-------------|:------|
88
+ | **Sense** | Chokidar watcher detects `add`, `change`, `unlink` events | < 10ms |
89
+ | **Extract** | Immune engine runs 3 built-in health checks (IMM-001..003) | < 5ms |
90
+ | **Adapt** | Matches symptom to stored antibody in SQLite (WAL mode) | < 1ms |
91
+ | **Mutate** | Applies RFC 6902 JSON-Patch to restore the file | < 25ms |
92
+
93
+ > Full cycle: **< 270ms** from file deletion to full recovery.
94
+
95
+ ---
96
+
97
+ ## The Magic 5 Commands
98
+
99
+ Everything you need. Nothing you don't.
100
+
101
+ | Command | Essence | Intelligence Inside |
102
+ |:--------|:--------|:--------------------|
103
+ | `afd start` | **Ignite** | Daemon spawn + Hook injection |
104
+ | `afd fix` | **Diagnose** | Symptom detection & Antibody learning |
105
+ | `afd score` | **Vitals** | Health dashboard & Auto-heal stats |
106
+ | `afd sync` | **Federate** | Vaccine payload export for cross-project immunity |
107
+ | `afd stop` | **Quarantine** | Graceful shutdown & cleanup |
108
+
109
+ ### Quick Reference
110
+
111
+ ```bash
112
+ afd start # Start daemon, inject hooks, begin watching
113
+ afd fix # Scan for issues, auto-patch, learn antibodies
114
+ afd score # Full diagnostic dashboard
115
+ afd sync # Export antibodies to .afd/global-vaccine-payload.json
116
+ afd stop # Graceful shutdown
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Dashboard: `afd score`
122
+
123
+ ```
124
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
125
+ β”‚ afd score β€” Daemon Diagnostics β”‚
126
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
127
+ β”‚ Ecosystem : Claude Code β”‚
128
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
129
+ β”‚ Uptime : 1h 23m β”‚
130
+ β”‚ Events : 156 β”‚
131
+ β”‚ Files Found : 8 β”‚
132
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
133
+ β”‚ Immune System β”‚
134
+ β”‚ ────────────────────────────── β”‚
135
+ β”‚ Antibodies : 7 β”‚
136
+ β”‚ Level : Fortified β”‚
137
+ β”‚ Auto-healed : 3 background events β”‚
138
+ β”‚ Last heal : IMM-003 (12m ago) β”‚
139
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
140
+ β”‚ Suppression Safety β”‚
141
+ β”‚ ────────────────────────────── β”‚
142
+ β”‚ Mass events skipped : 2 β”‚
143
+ β”‚ Dormant transitions : 0 β”‚
144
+ β”‚ Active first-taps : 1 β”‚
145
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
146
+ β”‚ Hologram Budget : 84% token savings β”‚
147
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Advanced Intelligence
153
+
154
+ ### Double-Tap Heuristic (Immune Tolerance)
155
+
156
+ `afd` distinguishes **accidents** from **intent**:
157
+
158
+ ```
159
+ $ rm .claudeignore # First tap β†’ afd heals it silently
160
+ $ rm .claudeignore # Second tap within 60s β†’ "You meant it."
161
+ [afd] Antibody IMM-001 set to dormant. Delete honored.
162
+ ```
163
+
164
+ | Scenario | Response |
165
+ |:---------|:---------|
166
+ | Single delete (accident) | Auto-heal + record first tap |
167
+ | Re-delete within 60s (intent) | Antibody goes dormant, deletion respected |
168
+ | Re-delete after 60s | Fresh first tap, heals again |
169
+ | 3+ deletes in 1s (git checkout) | Mass-event detected, all suppression paused |
170
+
171
+ ### Vaccine Network (Team Federation)
172
+
173
+ Export learned antibodies for your entire team:
174
+
175
+ ```bash
176
+ afd sync
177
+ # β†’ .afd/global-vaccine-payload.json
178
+ ```
179
+
180
+ The payload is sanitized (no absolute paths, no secrets) and portable. Drop it into any project, and `afd` inherits the immunity.
181
+
182
+ ### Hologram Extraction
183
+
184
+ When AI agents request file context, `afd` serves **token-efficient skeletons** β€” stripping comments and function bodies while preserving the full type signature:
185
+
186
+ ```
187
+ Original: 2,450 chars β†’ Hologram: 380 chars (84% savings)
188
+ ```
189
+
190
+ This keeps your AI agent's context window lean without losing structural understanding.
191
+
192
+ ---
193
+
194
+ ## Status Line
195
+
196
+ Real-time daemon status in Claude Code's status bar:
197
+
198
+ ```
199
+ πŸ›‘οΈ afd: OFF # Daemon not running
200
+ πŸ›‘οΈ afd: ON # Running, no heals
201
+ πŸ›‘οΈ afd: ON 🩹1 # 1 auto-heal event
202
+ πŸ›‘οΈ afd: ON | 🩹 3 Healed | last: IMM-003 # Detailed view
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Plugin / MCP Setup
208
+
209
+ `afd` can be registered as a **Model Context Protocol (MCP) server** inside Claude Code, allowing the daemon to start automatically when Claude Code launches.
210
+
211
+ ### Automatic (recommended)
212
+
213
+ Add to your Claude Code MCP config (`~/.claude/mcp.json` or project-level `.mcp.json`):
214
+
215
+ ```json
216
+ {
217
+ "mcpServers": {
218
+ "afd": {
219
+ "command": "bun",
220
+ "args": ["run", "src/cli.ts", "start"]
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ Or copy the included manifest directly:
227
+
228
+ ```bash
229
+ cp mcp-config.json .mcp.json
230
+ ```
231
+
232
+ ### Manual
233
+
234
+ ```bash
235
+ afd start # starts daemon in background, injects hooks
236
+ ```
237
+
238
+ Once registered, Claude Code will display the live status line:
239
+
240
+ ```
241
+ πŸ›‘οΈ afd: ON | 🩹 3 Healed | last: IMM-003
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Tech Stack
247
+
248
+ | Layer | Technology | Why |
249
+ |:------|:-----------|:----|
250
+ | Runtime | **Bun** | Native TypeScript, fast SQLite, single binary |
251
+ | Database | **Bun SQLite (WAL)** | 0.29ms reads, 24ms writes, crash-safe |
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
+ ---
257
+
258
+ ## Installation
259
+
260
+ ```bash
261
+ # With Bun (recommended)
262
+ bun install
263
+ bun link
264
+ afd start
265
+
266
+ # With npx (no install)
267
+ npx @dotoricode/afd start
268
+ ```
269
+
270
+ ### Requirements
271
+
272
+ - **Bun** >= 1.0
273
+ - **OS**: Windows, macOS, Linux
274
+ - **Target**: Claude Code, Cursor (ecosystem auto-detected)
275
+
276
+ ---
277
+
278
+ ## License
279
+
280
+ MIT
281
+
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "afd": {
4
+ "command": "bun",
5
+ "args": ["run", "src/cli.ts", "start"],
6
+ "description": "Autonomous Flow Daemon β€” self-healing AI development environment guardian. Monitors critical config files and auto-restores them within 270ms.",
7
+ "env": {}
8
+ }
9
+ }
10
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "autonomous-flow-daemon",
3
+ "version": "1.0.0",
4
+ "description": "Zero-config immunity for AI coding workflows. Self-heals broken configs in < 270ms.",
5
+ "type": "module",
6
+ "bin": {
7
+ "afd": "./src/cli.ts"
8
+ },
9
+ "main": "./src/cli.ts",
10
+ "files": [
11
+ "src/**/*.ts",
12
+ "mcp-config.json",
13
+ "README.md",
14
+ "README.ko.md",
15
+ "CHANGELOG.md",
16
+ "LICENSE"
17
+ ],
18
+ "keywords": [
19
+ "claude-code",
20
+ "self-healing",
21
+ "mcp",
22
+ "bun",
23
+ "ai-workflow",
24
+ "daemon",
25
+ "autonomous",
26
+ "dev-tools"
27
+ ],
28
+ "scripts": {
29
+ "start": "bun run src/cli.ts start",
30
+ "dev": "bun run src/cli.ts",
31
+ "test": "bun test"
32
+ },
33
+ "dependencies": {
34
+ "chokidar": "^4.0.3",
35
+ "commander": "^13.1.0",
36
+ "typescript": "^6.0.2"
37
+ },
38
+ "license": "MIT"
39
+ }