n2-soul 6.1.6 → 7.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/LICENSE CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  Apache License
3
2
  Version 2.0, January 2004
4
3
  http://www.apache.org/licenses/
@@ -35,19 +34,30 @@
35
34
 
36
35
  "Work" shall mean the work of authorship, whether in Source or
37
36
  Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work.
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
39
 
40
40
  "Derivative Works" shall mean any work, whether in Source or Object
41
41
  form, that is based on (or derived from) the Work and for which the
42
42
  editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship.
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
44
47
 
45
48
  "Contribution" shall mean any work of authorship, including
46
49
  the original version of the Work and any modifications or additions
47
50
  to that Work or Derivative Works thereof, that is intentionally
48
51
  submitted to the Licensor for inclusion in the Work by the copyright owner
49
52
  or by an individual or Legal Entity authorized to submit on behalf of
50
- the copyright owner.
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
51
61
 
52
62
  "Contributor" shall mean Licensor and any individual or Legal Entity
53
63
  on behalf of whom a Contribution has been received by the Licensor and
@@ -68,7 +78,13 @@
68
78
  where such license applies only to those patent claims licensable
69
79
  by such Contributor that are necessarily infringed by their
70
80
  Contribution(s) alone or by combination of their Contribution(s)
71
- with the Work to which such Contribution(s) was submitted.
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
72
88
 
73
89
  4. Redistribution. You may reproduce and distribute copies of the
74
90
  Work or Derivative Works thereof in any medium, with or without
@@ -90,21 +106,74 @@
90
106
  (d) If the Work includes a "NOTICE" text file as part of its
91
107
  distribution, then any Derivative Works that You distribute must
92
108
  include a readable copy of the attribution notices contained
93
- within such NOTICE file.
94
-
95
- 5. Submission of Contributions.
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
96
137
 
97
138
  6. Trademarks. This License does not grant permission to use the trade
98
- names, trademarks, service marks, or product names of the Licensor.
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
99
142
 
100
143
  7. Disclaimer of Warranty. Unless required by applicable law or
101
- agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
102
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
103
-
104
- 8. Limitation of Liability. In no event and under no legal theory shall
105
- any Contributor be liable to You for damages.
106
-
107
- 9. Accepting Warranty or Additional Liability.
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
108
177
 
109
178
  Copyright 2026 N2
110
179
 
package/README.ko.md CHANGED
@@ -270,6 +270,21 @@ DATA_DIR: '\\\\server\\team\\n2-soul' DATA_DIR: '\\\\server\\team\\n2-soul'
270
270
 
271
271
  Soul의 데이터는 **100% 일반 JSON 파일** — `soul-board.json`, 원장 기록, 두뇌 메모리. 폴더를 미러링하는 동기화 서비스(Google Drive, OneDrive, Dropbox, Syncthing, rsync)라면 뭐든 완벽하게 작동합니다. 데이터베이스 마이그레이션도, API 버전도, SDK 업데이트도 필요 없습니다. 그냥 파일입니다.
272
272
 
273
+ ## 🧹 스토리지 관리 및 GC (가비지 컬렉션)
274
+
275
+ 수백 번의 세션이 누적되면 파일 개수가 무한정 늘어나지 않을까요? Soul은 이 문제를 구조적으로 해결합니다:
276
+
277
+ ### 1. KV-Cache 가비지 컬렉션 (`n2_kv_gc`)
278
+ Soul에는 오래된 스냅샷을 자동으로 정리하는 `n2_kv_gc` 도구가 내장되어 있습니다.
279
+ 설정에서 `maxAgeDays`를 지정해두면, 에이전트가 주기적으로 불필요해진 과거 스냅샷을 삭제하여 용량을 관리합니다.
280
+
281
+ ### 2. 날짜별 파티셔닝 구조 (Ledger)
282
+ 절대 지워지지 않는 작업 기록(Ledger)은 거대한 단일 DB 파일이 아닙니다. `ledger/YYYY/MM/DD/` 형태로 날짜별로 완벽히 분리 저장됩니다.
283
+ 작년 기록을 백업하고 싶다면 `2025` 폴더만 압축하면 끝입니다. 6개월 지난 로그를 지우고 싶다면 해당 폴더만 지우면 됩니다. DB 파일이 꼬일 걱정이 0%입니다.
284
+
285
+ ### 3. OS 레벨 통제권
286
+ Soul의 데이터는 모두 '일반 파일'이므로, OS 기본 기능(크론탭, 윈도우 작업 스케줄러 등)으로 보존 주기 정책을 독립적으로 제어하기 매우 쉽습니다. 특정 프로젝트 데이터가 더 이상 필요 없다면 그냥 폴더를 통째로 지우세요. 보이지 않는 DB 찌꺼기가 남지 않습니다.
287
+
273
288
  ## Ark — 최후의 방패
274
289
 
275
290
  ![Ark Comic](docs/ark-comic.png)
package/README.md CHANGED
@@ -307,6 +307,20 @@ DATA_DIR: '\\\\server\\team\\n2-soul' DATA_DIR: '\\\\server\\team\\n2-soul'
307
307
 
308
308
  Soul's data is **100% plain JSON files** — `soul-board.json`, ledger entries, brain memory. Any sync service that mirrors folders (Google Drive, OneDrive, Dropbox, Syncthing, rsync) works perfectly because there's nothing to integrate. No database migrations, no API versions, no SDK updates. Just files.
309
309
 
310
+ ## 🧹 Storage Management & Garbage Collection
311
+
312
+ As agents run hundreds of sessions, file count inevitably grows. Soul handles this infinite growth gracefully:
313
+
314
+ ### 1. KV-Cache Garbage Collection (`n2_kv_gc`)
315
+ Soul includes a built-in `n2_kv_gc` tool that automatically cleans up old KV-Cache snapshots.
316
+ Set `maxAgeDays` in your config, and Soul will autonomously delete stale session data while preserving recent history.
317
+
318
+ ### 2. Time-Partitioned Ledger
319
+ The immutable work ledger isn't a single massive database file. It's partitioned by date (`ledger/YYYY/MM/DD/`).
320
+ Want to archive 2025's logs? Just zip the `2025` folder. Want to delete logs older than 6 months? Just delete the old folders. Zero database corruption risk.
321
+
322
+ ### 3. OS-Level Sovereignty
323
+ Because Soul's "cloud" is just your local filesystem mapped to a sync drive, you can use standard OS tools (cron jobs, Windows Task Scheduler, bash scripts) to enforce retention policies. If you delete a project folder, the project is gone. No dangling DB rows.
310
324
 
311
325
  ## Ark — The Last Shield
312
326
 
package/index.js CHANGED
@@ -1,19 +1,21 @@
1
- // Soul MCP v6.0 — Entry point. Multi-agent session orchestrator with KV-Cache + Ark.
1
+ // Soul MCP v7.0 — Entry point. Multi-agent session orchestrator with KV-Cache + Ark + Arachne.
2
2
  const path = require('path');
3
3
  const { McpServer } = require('@modelcontextprotocol/sdk/server/mcp.js');
4
4
  const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
5
5
  const { z } = require('zod');
6
6
  const config = require('./lib/config');
7
7
  const { createArk } = require('./lib/ark');
8
+ const { createArachne } = require('./lib/arachne');
8
9
 
9
10
  // Sequences — agent lifecycle management
10
11
  const { registerBootSequence } = require('./sequences/boot');
11
12
  const { registerWorkSequence } = require('./sequences/work');
12
13
  const { registerEndSequence } = require('./sequences/end');
13
14
 
14
- // Tools — shared memory + KV-Cache persistence
15
+ // Tools — shared memory + KV-Cache persistence + code context
15
16
  const { registerBrainTools } = require('./tools/brain');
16
17
  const { registerKVCacheTools } = require('./tools/kv-cache');
18
+ const { registerArachneTools } = require('./tools/arachne');
17
19
 
18
20
  const pkg = require('./package.json');
19
21
  const server = new McpServer({
@@ -57,13 +59,45 @@ server.registerTool = (name, schema, handler) => {
57
59
  };
58
60
  // ═══ End Ark ═══
59
61
 
60
- // Register all modules (all tools now pass through Ark)
62
+ // Register core modules (all tools pass through Ark)
61
63
  registerBootSequence(server, z, config);
62
64
  registerWorkSequence(server, z, config);
63
65
  registerEndSequence(server, z, config);
64
66
  registerBrainTools(server, z, config);
65
67
  registerKVCacheTools(server, z, config);
66
68
 
67
- // Start
68
- const transport = new StdioServerTransport();
69
- server.connect(transport);
69
+ // ═══════════════════════════════════════════════════════
70
+ // Arachne THE GREATEST WEAVER
71
+ // Code context assembly engine — indexes codebase,
72
+ // picks exactly what AI needs.
73
+ // Only activates when ARACHNE config is present.
74
+ // ═══════════════════════════════════════════════════════
75
+ async function boot() {
76
+ // Initialize Arachne (if configured)
77
+ if (config.ARACHNE?.projectDir) {
78
+ try {
79
+ const arachne = await createArachne({
80
+ dataDir: config.ARACHNE.dataDir ?? path.join(config.DATA_DIR, 'arachne'),
81
+ projectDir: config.ARACHNE.projectDir,
82
+ indexing: config.ARACHNE.indexing ?? { autoIndex: true },
83
+ search: config.ARACHNE.search ?? {},
84
+ assembly: config.ARACHNE.assembly ?? {},
85
+ backup: config.ARACHNE.backup ?? {},
86
+ embedding: config.ARACHNE.embedding ?? {},
87
+ });
88
+ registerArachneTools(server, z, arachne, config);
89
+ console.error(`[n2-soul] Arachne enabled: ${config.ARACHNE.projectDir}`);
90
+ } catch (err) {
91
+ console.error(`[n2-soul] Arachne init failed: ${err.message}`);
92
+ }
93
+ }
94
+
95
+ // Start MCP transport
96
+ const transport = new StdioServerTransport();
97
+ await server.connect(transport);
98
+ }
99
+
100
+ boot().catch(err => {
101
+ console.error(`[n2-soul] Fatal: ${err.message}`);
102
+ process.exit(1);
103
+ });
@@ -0,0 +1,4 @@
1
+ # Arachne Engine (Soul Embedded)
2
+
3
+ Code context assembly engine — indexes codebase, picks exactly what AI needs.
4
+ Follows the same embedded pattern as `lib/ark/` (Ark safety engine).