n2-soul 7.0.5 β 8.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/README.md +76 -7
- package/docs/soul-notebooklm-source.md +127 -0
- package/docs/soul-v8-roadmap.md +152 -0
- package/index.js +5 -74
- package/lib/kv-cache/index.js +399 -445
- package/lib/kv-cache/schema.js +20 -4
- package/lib/kv-cache/snapshot.js +139 -32
- package/lib/kv-cache/tier-manager.js +248 -239
- package/lib/soul-engine.js +22 -2
- package/lib/utils.js +53 -6
- package/package.json +2 -2
- package/sequences/boot.js +6 -19
- package/sequences/end.js +17 -22
- package/sequences/work.js +34 -45
- package/tools/brain.js +27 -45
- package/tools/kv-cache.js +225 -246
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://nodejs.org)
|
|
8
8
|
[](https://www.npmjs.com/package/n2-soul)
|
|
9
|
+
[](#whats-new-in-v80)
|
|
9
10
|
|
|
10
11
|
**Your AI agent forgets everything when a session ends. Soul fixes that.**
|
|
11
12
|
|
|
@@ -25,6 +26,7 @@ Every time you start a new chat with Cursor, VS Code Copilot, or any MCP-compati
|
|
|
25
26
|
|
|
26
27
|
## Table of Contents
|
|
27
28
|
|
|
29
|
+
- [What's New in v8.0](#whats-new-in-v80)
|
|
28
30
|
- [Quick Start](#quick-start)
|
|
29
31
|
- [Why Soul?](#why-soul)
|
|
30
32
|
- [Token Efficiency](#token-efficiency)
|
|
@@ -39,6 +41,61 @@ Every time you start a new chat with Cursor, VS Code Copilot, or any MCP-compati
|
|
|
39
41
|
- [Contributing](#contributing)
|
|
40
42
|
- [Sponsors](#-sponsors)
|
|
41
43
|
|
|
44
|
+
## What's New in v8.0
|
|
45
|
+
|
|
46
|
+
> **Forgetting Curve β Soul now remembers what matters and forgets what doesn't.**
|
|
47
|
+
|
|
48
|
+
### π§ Intelligent Memory (Forgetting Curve GC)
|
|
49
|
+
|
|
50
|
+
Inspired by Ebbinghaus' forgetting curve, Soul v8.0 intelligently manages memory retention:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
retention = importance Γ (1 + logβ(1 + accessCount)) Γ e^(βΞ» Γ ageDays)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- **Frequently accessed** sessions are kept longer
|
|
57
|
+
- **Important** snapshots resist decay
|
|
58
|
+
- **Stale** memory is automatically pruned via 3-tier lifecycle:
|
|
59
|
+
|
|
60
|
+
| Tier | Age | Storage |
|
|
61
|
+
|------|-----|--------|
|
|
62
|
+
| π΄ Hot | 0β7 days | In-memory cache + disk |
|
|
63
|
+
| π‘ Warm | 8β30 days | Disk only |
|
|
64
|
+
| π΅ Cold | 30+ days | Archived (compressed) |
|
|
65
|
+
|
|
66
|
+
### β‘ Performance Revolution β Async I/O
|
|
67
|
+
|
|
68
|
+
All hot-path I/O operations are now fully asynchronous:
|
|
69
|
+
|
|
70
|
+
| Operation | v7 (sync) | v8 (async) | Improvement |
|
|
71
|
+
|-----------|-----------|------------|-------------|
|
|
72
|
+
| KV Save | Blocks event loop | Non-blocking | β (no block) |
|
|
73
|
+
| KV Load | 1.2ms (blocking) | 0.7ms (async) | 42% faster |
|
|
74
|
+
| KV Search | Blocks | Parallel | 3x+ throughput |
|
|
75
|
+
| GC | Blocks during sweep | Background | Non-disruptive |
|
|
76
|
+
|
|
77
|
+
### π§ SDK Native Migration
|
|
78
|
+
|
|
79
|
+
- Removed legacy `registerTool` shim β direct `server.tool()` API
|
|
80
|
+
- Strict schema validation: `z.any()` eliminated from all tool definitions
|
|
81
|
+
- Full MCP SDK v1.6.1 compatibility
|
|
82
|
+
|
|
83
|
+
### π¦ Schema v2 (Backward Compatible)
|
|
84
|
+
|
|
85
|
+
Snapshots now include Forgetting Curve metadata. Existing v1 snapshots are **auto-migrated** on first load:
|
|
86
|
+
|
|
87
|
+
```diff
|
|
88
|
+
+ accessCount: 0 // How often this snapshot was accessed
|
|
89
|
+
+ lastAccessed: null // When it was last loaded
|
|
90
|
+
+ importance: 0.5 // 0.0β1.0 importance score
|
|
91
|
+
+ tier: 'warm' // hot / warm / cold
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
> [!NOTE]
|
|
95
|
+
> **Upgrading from v7.x**: Zero breaking changes. All existing data works as-is. Snapshots are transparently migrated to schema v2 on first access.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
42
99
|
## Quick Start
|
|
43
100
|
|
|
44
101
|
### 1. Install
|
|
@@ -224,10 +281,13 @@ n2_work_end(project, title, summary, todo, entities, insights)
|
|
|
224
281
|
| **Soul Board** | Project state + TODO tracking + handoffs between agents |
|
|
225
282
|
| **Immutable Ledger** | Every work session recorded as append-only log |
|
|
226
283
|
| **KV-Cache** | Session snapshots with compression + tiered storage (Hot/Warm/Cold) |
|
|
284
|
+
| **Forgetting Curve GC** | π v8 β Ebbinghaus-based intelligent memory retention |
|
|
285
|
+
| **Async I/O** | π v8 β Non-blocking I/O on all hot-path operations |
|
|
286
|
+
| **Schema v2** | π v8 β Access tracking + importance scoring + auto-migration |
|
|
227
287
|
| **Shared Brain** | File-based shared memory with path traversal protection |
|
|
228
|
-
| **Entity Memory** |
|
|
229
|
-
| **Core Memory** |
|
|
230
|
-
| **Autonomous Extraction** |
|
|
288
|
+
| **Entity Memory** | Auto-tracks people, hardware, projects, concepts across sessions |
|
|
289
|
+
| **Core Memory** | Agent-specific always-loaded facts (identity, rules, focus) |
|
|
290
|
+
| **Autonomous Extraction** | Auto-saves entities and insights at session end |
|
|
231
291
|
| **Context Search** | Keyword search across brain memory and ledger |
|
|
232
292
|
| **File Ownership** | Prevents multi-agent file editing collisions |
|
|
233
293
|
| **Dual Backend** | JSON (zero deps) or SQLite for performance |
|
|
@@ -301,9 +361,18 @@ Soul's data is **100% plain JSON files** β `soul-board.json`, ledger entries,
|
|
|
301
361
|
|
|
302
362
|
As agents run hundreds of sessions, file count inevitably grows. Soul handles this infinite growth gracefully:
|
|
303
363
|
|
|
304
|
-
### 1.
|
|
305
|
-
|
|
306
|
-
|
|
364
|
+
### 1. Forgetting Curve GC (`n2_kv_gc`) β π v8.0
|
|
365
|
+
|
|
366
|
+
Soul v8.0 replaces simple age-based deletion with **Ebbinghaus Forgetting Curve** scoring:
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
retention = importance Γ (1 + logβ(1 + accessCount)) Γ e^(β0.05 Γ ageDays)
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
- Snapshots with high `importance` or frequent `accessCount` survive longer
|
|
373
|
+
- Snapshots decay naturally over time (Ξ» = 0.05)
|
|
374
|
+
- Retention threshold: 0.1 (below this β eligible for deletion)
|
|
375
|
+
- `n2_kv_gc` reports retention scores so you can monitor memory health
|
|
307
376
|
|
|
308
377
|
### 2. Time-Partitioned Ledger
|
|
309
378
|
The immutable work ledger isn't a single massive database file. It's partitioned by date (`ledger/YYYY/MM/DD/`).
|
|
@@ -547,7 +616,7 @@ Soul is free and open-source. These amazing people help keep it alive:
|
|
|
547
616
|
|
|
548
617
|
## Star History
|
|
549
618
|
|
|
550
|
-
|
|
619
|
+
No coffee? A star is fine too βββ
|
|
551
620
|
|
|
552
621
|
---
|
|
553
622
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Soul β The Memory System That Makes AI Agents Actually Useful
|
|
2
|
+
|
|
3
|
+
## The Problem Nobody Talks About
|
|
4
|
+
|
|
5
|
+
Every time you open a new chat with Cursor, VS Code Copilot, Claude, or any AI coding assistant, your agent starts from absolute zero. It doesn't know what you worked on yesterday. It doesn't know what files it changed. It doesn't remember the bug it found 3 hours ago. It's like having a brilliant developer with permanent amnesia.
|
|
6
|
+
|
|
7
|
+
You end up spending the first 5-10 minutes of every session re-explaining context. "Remember the auth module? The one with JWT? We added rate limiting yesterday..." β and the agent has no idea.
|
|
8
|
+
|
|
9
|
+
**This is the single biggest productivity killer in AI-assisted development today.** Not model intelligence. Not context window size. Memory loss.
|
|
10
|
+
|
|
11
|
+
## What Soul Does
|
|
12
|
+
|
|
13
|
+
Soul is an open-source MCP (Model Context Protocol) server that gives AI agents persistent memory. Install it once, and your agents remember everything β across sessions, across agents, across days.
|
|
14
|
+
|
|
15
|
+
### The Magic: Two Commands
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Session start: n2_boot("rose", "my-project") β Agent loads all previous context
|
|
19
|
+
Session end: n2_work_end(...) β Agent saves everything for next time
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
That's it. Next session, your agent picks up exactly where it left off.
|
|
23
|
+
|
|
24
|
+
## Key Features That Make Soul Special
|
|
25
|
+
|
|
26
|
+
### 1. Persistent Memory (KV-Cache)
|
|
27
|
+
Every session is automatically saved as a snapshot. When you start a new session, Soul loads the previous context using progressive levels:
|
|
28
|
+
- **L1 (~500 tokens)**: Just keywords and TODO β ultra-fast startup
|
|
29
|
+
- **L2 (~2,000 tokens)**: Summary + decisions + context
|
|
30
|
+
- **L3 (full)**: Complete session restore
|
|
31
|
+
|
|
32
|
+
This means over 10 sessions, you save 30,000+ tokens on context alone.
|
|
33
|
+
|
|
34
|
+
### 2. Multi-Agent Handoffs
|
|
35
|
+
Agent Rose works on the auth module at 2pm. Agent Jenny picks up at 5pm. With Soul, Jenny knows exactly what Rose did, what's left to do, and what files were changed. No re-explanation needed.
|
|
36
|
+
|
|
37
|
+
### 3. Entity Memory (v5.0)
|
|
38
|
+
Soul automatically tracks people, hardware, projects, and concepts across sessions. Every entity is stored with attributes and auto-merged when updated.
|
|
39
|
+
|
|
40
|
+
### 4. Core Memory (v5.0)
|
|
41
|
+
Agent-specific facts that are always loaded at boot. An agent's identity, working rules, current focus β always available, never forgotten.
|
|
42
|
+
|
|
43
|
+
### 5. Shared Brain
|
|
44
|
+
Multiple agents can read and write to the same shared memory space. File-based, simple, with path traversal protection built in.
|
|
45
|
+
|
|
46
|
+
### 6. Immutable Ledger
|
|
47
|
+
Every work session is recorded as an append-only log. You can trace exactly what happened, when, and by whom.
|
|
48
|
+
|
|
49
|
+
### 7. File Ownership
|
|
50
|
+
Prevents two agents from editing the same file simultaneously. Simple, effective collision prevention.
|
|
51
|
+
|
|
52
|
+
## Ark β Built-in AI Safety (v6.0)
|
|
53
|
+
|
|
54
|
+
This is the feature that got people really excited on Reddit.
|
|
55
|
+
|
|
56
|
+
### The Problem
|
|
57
|
+
AI agents with tool access can execute dangerous commands. `rm -rf /` to delete everything. `DROP DATABASE` to destroy data. `git push --force` to rewrite history. These aren't hypothetical β autonomous agents have already done these things.
|
|
58
|
+
|
|
59
|
+
### Ark's Solution: Zero-Token Safety
|
|
60
|
+
|
|
61
|
+
Most AI safety solutions use another LLM to check if an action is safe. That costs 500-2,000 tokens per check and takes 1-5 seconds.
|
|
62
|
+
|
|
63
|
+
**Ark uses pure regex pattern matching inside the MCP server.** Zero tokens. Less than 1 millisecond. Always on β there's no toggle to disable it. It's like a firewall for your AI.
|
|
64
|
+
|
|
65
|
+
Key properties:
|
|
66
|
+
- **Zero token cost** β runs in Node.js, not in the LLM
|
|
67
|
+
- **Zero latency** β microsecond execution
|
|
68
|
+
- **Always on** β no `enabled: false` option (by design)
|
|
69
|
+
- **Self-protecting** β 4 layers prevent a rogue AI from disabling Ark itself
|
|
70
|
+
- **Human-readable rules** β `.n2` files anyone can read and customize
|
|
71
|
+
- **7 industry templates** β Medical (HIPAA), Military, Finance, Legal, Privacy (GDPR), Autonomous, DevOps
|
|
72
|
+
|
|
73
|
+
### .n2 Rule Files
|
|
74
|
+
|
|
75
|
+
Safety rules are written in a human-readable format:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
@rule catastrophic_destruction {
|
|
79
|
+
scope: all
|
|
80
|
+
blacklist: [/rm\s+-rf/, /DROP\s+DATABASE/i, /git\s+push\s+--force/i]
|
|
81
|
+
requires: human_approval
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Transparent, auditable, customizable. No black boxes.
|
|
86
|
+
|
|
87
|
+
## Cloud Storage (v6.1) β Zero-Cost Cloud in One Line
|
|
88
|
+
|
|
89
|
+
Soul takes a radically different approach to cloud storage:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
DATA_DIR: 'G:/My Drive/n2-soul' // That's it. Your AI memory is now in Google Drive.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Because Soul stores everything as plain JSON files, any folder sync service works as cloud storage. Google Drive (free 15GB), OneDrive, Dropbox, NAS, USB drive β all supported. Zero API keys. Zero monthly fees. Zero vendor lock-in.
|
|
96
|
+
|
|
97
|
+
For teams, point multiple agents to the same network path = instant shared memory with zero setup.
|
|
98
|
+
|
|
99
|
+
## The Numbers
|
|
100
|
+
|
|
101
|
+
- **41 GitHub stars in 2 days** (after Reddit launch)
|
|
102
|
+
- **7 forks** β people are actively building on it
|
|
103
|
+
- **v6.1.4** β actively maintained, shipping weekly
|
|
104
|
+
- **Only 3 dependencies** β minimal, lightweight, reliable
|
|
105
|
+
- **Node.js 18+** β runs anywhere
|
|
106
|
+
- **Apache-2.0 license** β fully open source
|
|
107
|
+
|
|
108
|
+
## The Story Behind Soul
|
|
109
|
+
|
|
110
|
+
Soul was created by a developer who came back to coding after 30 years. The frustration of watching AI agents forget everything between sessions was the catalyst. "I built Soul because it broke my heart watching my agents lose their memory every session."
|
|
111
|
+
|
|
112
|
+
What started as a personal tool grew into something the community actually wanted. The project went from zero to 41 stars in just two days after being posted on Reddit, with engaged discussions about enterprise use cases like Vault mode for secret management.
|
|
113
|
+
|
|
114
|
+
## Why Soul Matters
|
|
115
|
+
|
|
116
|
+
In the AI agent ecosystem, there are tools for making agents smarter (better models), tools for giving agents abilities (MCP servers), but almost nothing for giving agents **memory**. Soul fills that gap.
|
|
117
|
+
|
|
118
|
+
The vision: AI agents that truly know you, your codebase, your preferences. Agents that can hand off work to each other seamlessly. Agents that are safe by default, not by hope.
|
|
119
|
+
|
|
120
|
+
**Soul is the memory layer the AI ecosystem has been missing.**
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
π GitHub: github.com/choihyunsus/soul
|
|
125
|
+
π¦ npm: n2-soul
|
|
126
|
+
π Website: nton2.com
|
|
127
|
+
π Sponsor: github.com/sponsors/choihyunsus
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# π§ Soul v8.0 Roadmap β The Heart Upgrade
|
|
2
|
+
|
|
3
|
+
> κΈ°νμΌ: 2026-03-26 | μν: Planning
|
|
4
|
+
|
|
5
|
+
## λ°°κ²½
|
|
6
|
+
|
|
7
|
+
Soulμ N2 μνκ³μ **μ¬μ₯**μ΄λ€. λ€λ₯Έ ν¨ν€μ§(Clotho, Ark, Arachne, QLN, Mimir)λ μ΅μ
μ΄μ§λ§ Soul μμ΄λ μ무κ²λ λμκ°μ§ μλλ€.
|
|
8
|
+
|
|
9
|
+
νμ¬ Soul v7.0.6μ μ΄μ°½κΈ° CJSλ‘ μμ±λμκ³ , μν€ν
μ²λ νννμ§λ§ νμ§ μΈνλΌ(νμ
, ν
μ€νΈ, λ‘κΉ
)μ μ±λ₯ μ΅μ ν(λκΈ°I/O, O(n) κ²μ)μ μ½μ μ΄ μλ€.
|
|
10
|
+
|
|
11
|
+
**λͺ©ν**: ꡬ쑰λ₯Ό λ§κ°λ¨λ¦¬μ§ μμΌλ©΄μ 2μ€ 3μ€μΌλ‘ μμ νκ³ λΉ λ₯΄κ² μ
κ·Έλ μ΄λνλ€. λ©λͺ¨λ¦¬ κ΄λ ¨μ΄λ―λ‘ λ¬΄κ²μ§ μκ².
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Phase 1: κΈ°λ° λ€μ§κΈ° β
μλ£ (v7.1)
|
|
16
|
+
|
|
17
|
+
| νλͺ© | μν | μ€λͺ
|
|
|
18
|
+
|------|:----:|------|
|
|
19
|
+
| description μ
λ°μ΄νΈ | β
| Ark/Arachne ꡬμ μ°Έμ‘° μ κ±° |
|
|
20
|
+
| 4λ 벨 λ‘κ·Έ μμ€ν
| β
| debug/info/warn/error + `N2_LOG_LEVEL` νκ²½λ³μ μ μ΄ |
|
|
21
|
+
| info λ 벨 λ‘κ·Έ μ νν | β
| logError λ¨μ© β logInfo μμ (3κ³³) |
|
|
22
|
+
| Board μΈλ©λͺ¨λ¦¬ μΊμ | β
| mtime κΈ°λ° λ¬΄ν¨νλ‘ λ©ν°μμ΄μ νΈ μμ μ± μ μ§ |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Phase 2: μ±λ₯ νμ
|
|
27
|
+
|
|
28
|
+
| νλͺ© | λμ΄λ | μ€λͺ
|
|
|
29
|
+
|------|:------:|------|
|
|
30
|
+
| sqlite-vec λ²‘ν° μΈλ±μ€ | π‘ | μλ§¨ν± κ²μ O(n) β O(1). sqlite-vec μ΄λ―Έ μμ‘΄μ±μ μμ |
|
|
31
|
+
| ν« ν¨μ€ async I/O | π | save/load/searchμ λκΈ° I/O β λΉλκΈ° μ ν |
|
|
32
|
+
| registerTool shim μ κ±° | π‘ | MCP SDK λ€μ΄ν°λΈ μ¬μ©μΌλ‘ κΈ°μ λΆμ± ν΄μ |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Phase 3: Forgetting Curve β μΈκ°ν κΈ°μ΅ μμ€ν
|
|
37
|
+
|
|
38
|
+
> Soul λ¨λ
μΌλ‘ ꡬν κ°λ₯. κ°μ₯ μ¦κ°μ μΈ ν¨κ³Ό.
|
|
39
|
+
|
|
40
|
+
νμ¬: μ€λ
μ· 50κ° μ ν, 30μΌ λ§λ£ β κΈ°κ³μ μμ
|
|
41
|
+
|
|
42
|
+
### 3λ¨κ³ κΈ°μ΅ κ³μΈ΅
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
46
|
+
β π΄ Hot Memory (μ΅κ·Ό 7μΌ + μμ£Ό μ κ·Ό) β
|
|
47
|
+
β β μ 체 μ€λ
μ· λ³΄κ΄ β
|
|
48
|
+
β β μ¦μ λ‘λ κ°λ₯ β
|
|
49
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
50
|
+
β π‘ Warm Memory (7~30μΌ) β
|
|
51
|
+
β β μμ½ + ν΅μ¬ κ²°μ μ¬νλ§ λ³΄κ΄ β
|
|
52
|
+
β β ν ν° μ μ½ 80%+ β
|
|
53
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
54
|
+
β π΅ Cold Memory (30μΌ+) β
|
|
55
|
+
β β ν€μλ + λ©νλ°μ΄ν°λ§ λ³΄κ΄ β
|
|
56
|
+
β β νμ μ λ°±μ
μμ μ 체 볡μ β
|
|
57
|
+
β β λ©λͺ¨λ¦¬ μ¬μ©λ 95% κ°μ β
|
|
58
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### μ κ·Ό λΉλ κΈ°λ° μΉκ²©/κ°λ±
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
κΈ°μ΅ A: λ§€μΌ κ²μλ¨ β Hot μ μ§
|
|
65
|
+
κΈ°μ΅ B: 2μ£Ό μ λ§μ§λ§ μ κ·Ό β WarmμΌλ‘ κ°λ±
|
|
66
|
+
κΈ°μ΅ C: 2λ¬ μ , ν λ²λ κ²μ μ λ¨ β Coldλ‘ κ°λ±
|
|
67
|
+
κΈ°μ΅ D: ColdμΈλ° κ°μκΈ° κ²μλ¨ β WarmμΌλ‘ μΉκ²©
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Phase 4: Soul Γ Arachne μ°λ
|
|
73
|
+
|
|
74
|
+
> Arachneμ μ½λ μ΄ν΄ λ₯λ ₯μ Soulμ κΈ°μ΅μ κ²°ν©
|
|
75
|
+
|
|
76
|
+
### Smart Memory Compression
|
|
77
|
+
- νμ¬: ν
μ€νΈ κΈΈμ΄ κΈ°λ° λ¨μ μμΆ
|
|
78
|
+
- μ°λ ν: Arachneμ BM25λ‘ νμ¬ νλ‘μ νΈμ κ΄λ ¨ μλ κΈ°μ΅μ μ μ§, 무κ΄ν 건 μΆμ
|
|
79
|
+
- κ°μ ν ν° μμ°μΌλ‘ **2-3λ°° λ μ νν 컨ν
μ€νΈ**
|
|
80
|
+
|
|
81
|
+
### Memory-Aware Code Search
|
|
82
|
+
- Soulμ΄ "μ΄ μμ΄μ νΈκ° μ§λ μΈμ
μ μμ ν νμΌ" μ 보λ₯Ό Arachneμ μ λ¬
|
|
83
|
+
- Arachneκ° κ²μ μ°μ μμλ₯Ό μλ μ‘°μ
|
|
84
|
+
- μμ΄μ νΈκ° μ΅κ·Ό μμ
ν νμΌμ΄ κ²μ μμμ λ
ΈμΆ
|
|
85
|
+
|
|
86
|
+
### Cross-Session Impact Analysis
|
|
87
|
+
- Soul: "μ§λ μΈμ
μ auth.tsλ₯Ό μμ νλ€"
|
|
88
|
+
- Arachne: "auth.tsλ₯Ό importνλ νμΌ 15κ°κ° μν₯λ°μ μ μλ€"
|
|
89
|
+
- λΆν
μ μλμΌλ‘ μν₯ λ²μ μλ¦Ό
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Phase 5: Soul Γ Mimir μ°λ
|
|
94
|
+
|
|
95
|
+
> Mimirμ κ²½ν νμ΅μ Soulμ μΈμ
λ°μ΄ν°μ μ μ©
|
|
96
|
+
|
|
97
|
+
### Auto-Learning Ledger
|
|
98
|
+
```
|
|
99
|
+
μμ
λ β Ledgerμ κΈ°λ‘ β Mimirκ° μλ λΆμ
|
|
100
|
+
β "TypeScript strict νλ‘μ νΈμμ interface λμ type μΌμ λ 3λ² μμ ν¨"
|
|
101
|
+
β λ€μμ κ°μ μν©μ΄λ©΄ μλμΌλ‘ interface μΆμ²
|
|
102
|
+
```
|
|
103
|
+
- λͺ¨λ μμ
μΈμ
μ΄ μλμΌλ‘ νμ΅ λ°μ΄ν°κ° λλ€
|
|
104
|
+
- λͺ
μμ `study_start/add/end` μμ΄λ νμ΅
|
|
105
|
+
|
|
106
|
+
### Experience-Guided Decisions
|
|
107
|
+
- λΉμ·ν μν©μμ κ³Όκ±° μ΄λ€ κ²°μ μ νλμ§ μλ μμ μ€νΈ
|
|
108
|
+
- Ledgerμ `decisions` νλλ₯Ό Mimirκ° λΆμ
|
|
109
|
+
- "μ΄μ μ λΉμ·ν 리ν©ν λ§μμ X μ κ·Όλ²μ μ ννκ³ μ±κ³΅νλ€"
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Phase 6: 3μ μ°λ β Predictive Context Loading
|
|
114
|
+
|
|
115
|
+
> κ°μ₯ 볡μ‘νμ§λ§ κ°μ₯ κ°λ ₯ν κΈ°λ₯
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
λΆν
:
|
|
119
|
+
1. Soul β μ΄μ μΈμ
KV-Cache λ‘λ
|
|
120
|
+
2. Mimir β ν¨ν΄ λΆμ: "μ΄ μμ΄μ νΈλ λ³΄ν΅ μ΄ μκ°μ μ΄ νλ‘μ νΈμ μ΄λ° μμ
μ νλ€"
|
|
121
|
+
3. Arachne β μμΈ‘λ μμ
μ νμν μ½λ 컨ν
μ€νΈλ₯Ό 미리 λ‘λ
|
|
122
|
+
|
|
123
|
+
κ²°κ³Ό: μμ΄μ νΈκ° μ§λ¬ΈνκΈ°λ μ μ νμν μ λ³΄κ° μ€λΉλμ΄ μλ€
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Phase 7: νμ§ λ³΄μ¦
|
|
129
|
+
|
|
130
|
+
| νλͺ© | μ€λͺ
|
|
|
131
|
+
|------|------|
|
|
132
|
+
| μ λ ν
μ€νΈ 20κ°+ | SoulEngine, KV-Cache save/load/search, Board μΊμ |
|
|
133
|
+
| ν΅ν© ν
μ€νΈ | λΆν
β μμ
β μ’
λ£ μ 체 μνμ€ |
|
|
134
|
+
| CI/CD | GitHub Actions μλ ν
μ€νΈ |
|
|
135
|
+
| TypeScript κ²ν | JSDoc `@ts-check` λλ μ λ©΄ λ§μ΄κ·Έλ μ΄μ
κ²°μ |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## μ°μ μμ μμ½
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
μ¦μ Phase 1 β
β λ‘κ·Έ, μΊμ, description
|
|
143
|
+
λ¨κΈ° Phase 2 β sqlite-vec, async I/O
|
|
144
|
+
μ€κΈ° Phase 3 β Forgetting Curve (Soul λ¨λ
)
|
|
145
|
+
μ€μ₯κΈ° Phase 4-5 β Arachne/Mimir μ°λ
|
|
146
|
+
μ₯κΈ° Phase 6 β 3μ μ°λ (Predictive Loading)
|
|
147
|
+
μ§μ Phase 7 β ν
μ€νΈ, νμ
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
> *"Soulμ κΈ°μ΅μ΄λ€. κΈ°μ΅μ΄ ν¨μ¨μ μ΄λ©΄ AIλ λ λΉ λ₯΄κ³ , λ μ ννκ³ , λ μ±μ₯νλ€."*
|
package/index.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
// Soul MCP
|
|
2
|
-
const path = require('path');
|
|
1
|
+
// Soul MCP v8.0 β Entry point. Multi-agent session orchestrator with KV-Cache.
|
|
3
2
|
const { McpServer } = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
4
3
|
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
5
4
|
const { z } = require('zod');
|
|
6
5
|
const config = require('./lib/config');
|
|
7
|
-
const { createArk } = require('./lib/ark');
|
|
8
|
-
const { createArachne } = require('./lib/arachne');
|
|
9
6
|
|
|
10
7
|
// Sequences β agent lifecycle management
|
|
11
8
|
const { registerBootSequence } = require('./sequences/boot');
|
|
12
9
|
const { registerWorkSequence } = require('./sequences/work');
|
|
13
10
|
const { registerEndSequence } = require('./sequences/end');
|
|
14
11
|
|
|
15
|
-
// Tools β shared memory + KV-Cache persistence
|
|
12
|
+
// Tools β shared memory + KV-Cache persistence
|
|
16
13
|
const { registerBrainTools } = require('./tools/brain');
|
|
17
14
|
const { registerKVCacheTools } = require('./tools/kv-cache');
|
|
18
|
-
const { registerArachneTools } = require('./tools/arachne');
|
|
19
15
|
|
|
20
16
|
const pkg = require('./package.json');
|
|
21
17
|
const server = new McpServer({
|
|
@@ -23,80 +19,15 @@ const server = new McpServer({
|
|
|
23
19
|
version: pkg.version,
|
|
24
20
|
});
|
|
25
21
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
// "You shall not pass."
|
|
29
|
-
//
|
|
30
|
-
// Pure & simple: every tool call β check against rules.
|
|
31
|
-
// No tool classification. No special cases.
|
|
32
|
-
// The RULES decide what's blocked β not the code.
|
|
33
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
34
|
-
const ark = createArk({
|
|
35
|
-
rulesDir: config.ARK?.rulesDir ?? path.join(__dirname, 'rules'),
|
|
36
|
-
auditDir: config.ARK?.auditDir ?? path.join(config.DATA_DIR, 'ark-audit'),
|
|
37
|
-
strictMode: config.ARK?.strictMode ?? false,
|
|
38
|
-
auditMaxAgeDays: config.ARK?.auditMaxAgeDays ?? 7,
|
|
39
|
-
auditEnabled: true,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Ark-wrapped registerTool shim β bridges legacy registerTool() to SDK v1.6.1 server.tool()
|
|
43
|
-
const _origTool = server.tool.bind(server);
|
|
44
|
-
const _arkWrap = (name, handler) => async (args) => {
|
|
45
|
-
const content = JSON.stringify(args);
|
|
46
|
-
const result = ark.check(name, content, 'tool_call');
|
|
47
|
-
if (!result.allowed) {
|
|
48
|
-
return {
|
|
49
|
-
content: [{
|
|
50
|
-
type: 'text',
|
|
51
|
-
text: `[n2-ark] BLOCKED: ${result.reason}\n` +
|
|
52
|
-
`Rule: ${result.rule} | Action: ${result.action}\n` +
|
|
53
|
-
`This action requires human approval.`,
|
|
54
|
-
}],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return handler(args);
|
|
58
|
-
};
|
|
59
|
-
// Shim: server.registerTool(name, {title, description, inputSchema}, handler) β server.tool()
|
|
60
|
-
server.registerTool = (name, schema, handler) => {
|
|
61
|
-
const desc = schema.description || schema.title || name;
|
|
62
|
-
_origTool(name, desc, schema.inputSchema || {}, _arkWrap(name, handler));
|
|
63
|
-
};
|
|
64
|
-
// Override: server.tool() with Ark check (for files using new API directly, e.g. arachne.js)
|
|
65
|
-
server.tool = (name, ...rest) => {
|
|
66
|
-
const handler = rest.pop();
|
|
67
|
-
_origTool(name, ...rest, _arkWrap(name, handler));
|
|
68
|
-
};
|
|
69
|
-
// βββ End Ark βββ
|
|
70
|
-
|
|
71
|
-
// Register core modules (all tools pass through Ark)
|
|
72
|
-
registerBootSequence(server, z, config, ark.workflows);
|
|
22
|
+
// Register core modules β all tools use SDK-native server.tool() directly
|
|
23
|
+
registerBootSequence(server, z, config);
|
|
73
24
|
registerWorkSequence(server, z, config);
|
|
74
25
|
registerEndSequence(server, z, config);
|
|
75
26
|
registerBrainTools(server, z, config);
|
|
76
27
|
registerKVCacheTools(server, z, config);
|
|
77
28
|
|
|
78
|
-
//
|
|
79
|
-
// Arachne β THE GREATEST WEAVER
|
|
80
|
-
// Code context assembly engine β indexes codebase,
|
|
81
|
-
// picks exactly what AI needs.
|
|
82
|
-
// Only activates when ARACHNE config is present.
|
|
83
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
29
|
+
// Start MCP transport
|
|
84
30
|
async function boot() {
|
|
85
|
-
// Initialize Arachne (if configured)
|
|
86
|
-
if (config.ARACHNE?.projectDir) {
|
|
87
|
-
try {
|
|
88
|
-
const arachne = await createArachne({
|
|
89
|
-
...config.ARACHNE,
|
|
90
|
-
dataDir: config.ARACHNE.dataDir ?? path.join(config.DATA_DIR, 'arachne'),
|
|
91
|
-
});
|
|
92
|
-
registerArachneTools(server, z, arachne, config);
|
|
93
|
-
console.error(`[n2-soul] Arachne enabled: ${config.ARACHNE.projectDir}`);
|
|
94
|
-
} catch (err) {
|
|
95
|
-
console.error(`[n2-soul] Arachne init failed: ${err.message}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Start MCP transport
|
|
100
31
|
const transport = new StdioServerTransport();
|
|
101
32
|
await server.connect(transport);
|
|
102
33
|
}
|