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 +46 -0
- package/LICENSE +21 -0
- package/README.ko.md +249 -0
- package/README.md +281 -0
- package/mcp-config.json +10 -0
- package/package.json +39 -0
- package/src/adapters/index.ts +158 -0
- package/src/cli.ts +49 -0
- package/src/commands/diagnose.ts +151 -0
- package/src/commands/fix.ts +138 -0
- package/src/commands/score.ts +148 -0
- package/src/commands/start.ts +55 -0
- package/src/commands/stop.ts +35 -0
- package/src/commands/sync.ts +50 -0
- package/src/constants.ts +7 -0
- package/src/core/db.ts +46 -0
- package/src/core/hologram.ts +243 -0
- package/src/core/immune.ts +150 -0
- package/src/core/notify.ts +35 -0
- package/src/daemon/client.ts +37 -0
- package/src/daemon/server.ts +371 -0
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§ion=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§ion=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
|
+
|
package/mcp-config.json
ADDED
|
@@ -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
|
+
}
|