n2-soul 7.0.3 β 7.0.4
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 +18 -330
- package/lib/config.default.js +4 -58
- package/package.json +1 -1
- package/lib/arachne/README.md +0 -4
- package/lib/arachne/assembler.js +0 -441
- package/lib/arachne/backup.js +0 -218
- package/lib/arachne/chunker.js +0 -347
- package/lib/arachne/dependency.js +0 -195
- package/lib/arachne/embedding.js +0 -131
- package/lib/arachne/ignore.js +0 -134
- package/lib/arachne/index.js +0 -116
- package/lib/arachne/indexer.js +0 -194
- package/lib/arachne/search.js +0 -208
- package/lib/arachne/store.js +0 -420
- package/lib/arachne/vector-store.js +0 -159
- package/lib/ark/README.md +0 -7
- package/lib/ark/audit.js +0 -183
- package/lib/ark/examples/README.md +0 -14
- package/lib/ark/examples/autonomous.n2 +0 -68
- package/lib/ark/examples/financial.n2 +0 -42
- package/lib/ark/examples/legal.n2 +0 -70
- package/lib/ark/examples/medical.n2 +0 -73
- package/lib/ark/examples/military.n2 +0 -73
- package/lib/ark/examples/privacy.n2 +0 -83
- package/lib/ark/examples/system.n2 +0 -35
- package/lib/ark/gate.js +0 -232
- package/lib/ark/index.js +0 -111
- package/lib/ark/parser.js +0 -370
- package/rules/README.md +0 -4
- package/rules/default.n2 +0 -388
- package/tests/test-ark-integration.js +0 -82
- package/tools/arachne.js +0 -214
package/README.md
CHANGED
|
@@ -6,21 +6,8 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://nodejs.org)
|
|
8
8
|
[](https://www.npmjs.com/package/n2-soul)
|
|
9
|
-
[](https://github.com/choihyunsus/soul#arachne--the-greatest-weaver)
|
|
10
9
|
|
|
11
10
|
**Your AI agent forgets everything when a session ends. Soul fixes that.**
|
|
12
|
-
**Your AI agent might do something dangerous. Ark stops that.**
|
|
13
|
-
**Your AI agent wastes tokens reading irrelevant code. Arachne fixes that.**
|
|
14
|
-
|
|
15
|
-
> ### π What's New in v7.0 β Arachne
|
|
16
|
-
>
|
|
17
|
-
> **Arachne** β Code Context Assembly Engine. Indexes your entire codebase and picks **exactly** what your AI needs.
|
|
18
|
-
> ```
|
|
19
|
-
> 50,000 file project β 30 most relevant chunks β 30K tokens (instead of 500K+)
|
|
20
|
-
> ```
|
|
21
|
-
> BM25 search + dependency tracking + smart assembly. Optional semantic search via Ollama. [Learn more β](#arachne--the-greatest-weaver)
|
|
22
|
-
>
|
|
23
|
-
> Also includes **Ark** (v6.0) β built-in AI safety that blocks dangerous actions at zero token cost. [Learn more β](#ark--the-last-shield)
|
|
24
11
|
|
|
25
12
|
Every time you start a new chat with Cursor, VS Code Copilot, or any MCP-compatible AI agent, it starts from zero β no memory of what it did before. Soul is an MCP server that gives your agents:
|
|
26
13
|
|
|
@@ -28,10 +15,11 @@ Every time you start a new chat with Cursor, VS Code Copilot, or any MCP-compati
|
|
|
28
15
|
- π€ **Handoffs** so one agent can pick up where another left off
|
|
29
16
|
- π **Work history** recorded as an immutable log
|
|
30
17
|
- ποΈ **Shared brain** so multiple agents can read/write the same context
|
|
31
|
-
- π·οΈ **Entity Memory** β auto-tracks people, hardware, projects
|
|
32
|
-
- π‘ **Core Memory** β agent-specific always-loaded facts
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
- π·οΈ **Entity Memory** β auto-tracks people, hardware, projects
|
|
19
|
+
- π‘ **Core Memory** β agent-specific always-loaded facts
|
|
20
|
+
|
|
21
|
+
> π **Works great with the N2 ecosystem:**
|
|
22
|
+
> [**Ark**](https://github.com/choihyunsus/n2-ark) (AI safety) Β· [**Arachne**](https://github.com/choihyunsus/n2-arachne) (code context) Β· [**QLN**](https://github.com/choihyunsus/n2-QLN) (tool routing)
|
|
35
23
|
|
|
36
24
|
> β‘ **Soul is one small component of N2 Browser** β an AI-native browser we're building. Multi-agent orchestration, real-time tool routing, inter-agent communication, and much more are currently in testing. This is just the beginning.
|
|
37
25
|
|
|
@@ -47,10 +35,9 @@ Every time you start a new chat with Cursor, VS Code Copilot, or any MCP-compati
|
|
|
47
35
|
- [Real-World Example](#real-world-example)
|
|
48
36
|
- [Rust Compiler (n2c)](#rust-compiler-n2c)
|
|
49
37
|
- [Configuration](#configuration)
|
|
38
|
+
- [N2 Ecosystem](#-n2-ecosystem)
|
|
50
39
|
- [Contributing](#contributing)
|
|
51
40
|
- [Sponsors](#-sponsors)
|
|
52
|
-
- [Ark β The Last Shield](#ark--the-last-shield)
|
|
53
|
-
- [Arachne β The Greatest Weaver](#arachne--the-greatest-weaver)
|
|
54
41
|
|
|
55
42
|
## Quick Start
|
|
56
43
|
|
|
@@ -246,9 +233,7 @@ n2_work_end(project, title, summary, todo, entities, insights)
|
|
|
246
233
|
| **Dual Backend** | JSON (zero deps) or SQLite for performance |
|
|
247
234
|
| **Semantic Search** | Optional Ollama embedding (nomic-embed-text) |
|
|
248
235
|
| **Backup/Restore** | Incremental backups with configurable retention |
|
|
249
|
-
| **
|
|
250
|
-
| **Arachne** | π Code context assembly β indexes codebase, picks exactly what AI needs (v7.0) |
|
|
251
|
-
| **Cloud Storage** | π Store memory anywhere β Google Drive, NAS, network server, any path (v6.1) |
|
|
236
|
+
| **Cloud Storage** | Store memory anywhere β Google Drive, NAS, network server, any path |
|
|
252
237
|
|
|
253
238
|
## βοΈ Cloud Storage β Store Your AI Memory Anywhere
|
|
254
239
|
|
|
@@ -327,315 +312,21 @@ Want to archive 2025's logs? Just zip the `2025` folder. Want to delete logs old
|
|
|
327
312
|
### 3. OS-Level Sovereignty
|
|
328
313
|
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.
|
|
329
314
|
|
|
330
|
-
##
|
|
331
|
-
|
|
332
|
-

|
|
333
|
-
|
|
334
|
-
**The Last Shield** β Soul v6.0 includes **Ark**, a built-in AI safety system. Like Noah's Ark β the last refuge when everything else fails.
|
|
335
|
-
|
|
336
|
-
### Why Ark?
|
|
337
|
-
|
|
338
|
-
| | Ark | LLM-based safety | Embedding-based |
|
|
339
|
-
|---|:---:|:---:|:---:|
|
|
340
|
-
| **Token cost** | 0 | 500~2,000 per check | 100~500 per check |
|
|
341
|
-
| **Latency** | < 1ms | 1~5 seconds | 200~500ms |
|
|
342
|
-
| **New dependencies** | 0 (pure JS) | LLM API key required | Vector DB required |
|
|
343
|
-
| **Works offline** | Yes | No | Depends |
|
|
344
|
-
| **Always on** | Mandatory (no toggle) | Optional | Optional |
|
|
345
|
-
| **Self-protection** | 4-layer anti-tampering | None | None |
|
|
346
|
-
| **Rule format** | Human-readable `.n2` files | Prompt engineering | Embedding tuning |
|
|
347
|
-
| **Industry templates** | 7 domains included | Write your own | Write your own |
|
|
348
|
-
| **Audit trail** | Every block/pass logged | Varies | Varies |
|
|
349
|
-
| **Setup** | Zero config (works out of box) | API keys + prompts | DB + embeddings |
|
|
350
|
-
| **MCP compatible** | Any host (Cursor, VS Code, Claude Desktop) | Host-specific | Host-specific |
|
|
351
|
-
|
|
352
|
-
### The Problem
|
|
353
|
-
|
|
354
|
-
AI agents with tool access can execute dangerous commands:
|
|
355
|
-
- `rm -rf /` β delete everything
|
|
356
|
-
- `DROP DATABASE` β destroy data
|
|
357
|
-
- `npm install -g malware` β supply chain attack
|
|
358
|
-
- `git push --force` β destroy history
|
|
359
|
-
- Send emails, make payments, exfiltrate data
|
|
360
|
-
|
|
361
|
-
These aren't hypothetical. Autonomous agents (Manus, Devin, etc.) have already done these things in the wild.
|
|
362
|
-
|
|
363
|
-
### How Ark Works
|
|
364
|
-
|
|
365
|
-
```
|
|
366
|
-
Agent calls tool β MCP Server receives request
|
|
367
|
-
β
|
|
368
|
-
ark.check(name, content)
|
|
369
|
-
β
|
|
370
|
-
βββββββββ΄ββββββββ
|
|
371
|
-
β Match rules? β
|
|
372
|
-
βββββ¬ββββ¬ββββ
|
|
373
|
-
No β β Yes
|
|
374
|
-
β β
|
|
375
|
-
Execute β β BLOCKED
|
|
376
|
-
handler β β "This action requires
|
|
377
|
-
β β human approval."
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
**Key properties:**
|
|
381
|
-
- **Zero token cost** β Pure regex matching in Node.js, no LLM calls
|
|
382
|
-
- **Zero latency** β Microsecond execution time
|
|
383
|
-
- **Always on** β No `enabled` toggle. Ark loads unconditionally at boot
|
|
384
|
-
- **Transparent** β Agents don't even know it's there until blocked
|
|
385
|
-
- **Auditable** β Every block and pass is logged
|
|
386
|
-
|
|
387
|
-
### Token Cost: Zero
|
|
388
|
-
|
|
389
|
-
**Why zero?** Because Ark runs **inside the MCP server** (Node.js), not inside the AI model.
|
|
390
|
-
|
|
391
|
-
```
|
|
392
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
393
|
-
β LLM (Cloud) β
|
|
394
|
-
β AI agent thinks, generates tool calls β
|
|
395
|
-
β (this is where tokens are used) β
|
|
396
|
-
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
|
|
397
|
-
β tool call
|
|
398
|
-
βΌ
|
|
399
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
400
|
-
β MCP Server (Node.js, local) β
|
|
401
|
-
β β
|
|
402
|
-
β ββββββββββββββββ β
|
|
403
|
-
β β ark.check() β βββ pure regex, runs HERE β
|
|
404
|
-
β β < 1ms β no network, no LLM, no tokens β
|
|
405
|
-
β ββββββββ¬ββββββββ β
|
|
406
|
-
β β β
|
|
407
|
-
β allowed? ββNoβββΊ return "BLOCKED" text β
|
|
408
|
-
β β β
|
|
409
|
-
β Yes β
|
|
410
|
-
β β β
|
|
411
|
-
β execute handler β
|
|
412
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
The key insight: **token cost only occurs inside the LLM**. Ark lives one layer below β at the server level. The LLM sends a tool call, and Ark checks it using regex before the handler runs. No second LLM call, no API request, no vector search. Just string matching.
|
|
416
|
-
|
|
417
|
-
Most AI safety solutions work like this:
|
|
418
|
-
```
|
|
419
|
-
Agent β "I want to run rm -rf /" β Safety LLM: "Is this safe?" β 2,000 tokens burned
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
Ark works like this:
|
|
423
|
-
```
|
|
424
|
-
Agent β "I want to run rm -rf /" β regex match β BLOCKED (0 tokens, < 1ms)
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
| Approach | How it works | Cost per check | Latency |
|
|
428
|
-
|----------|-------------|:--------------:|:-------:|
|
|
429
|
-
| **LLM-based safety** | Send action to another LLM for review | 500~2,000 tokens | 1~5s |
|
|
430
|
-
| **Embedding-based** | Vectorize + similarity search | 100~500 tokens | 200~500ms |
|
|
431
|
-
| **Ark** | Regex pattern matching in Node.js | **0 tokens** | **< 1ms** |
|
|
432
|
-
|
|
433
|
-
Over 100 tool calls per session, that's **50,000~200,000 tokens saved** compared to LLM-based safety.
|
|
434
|
-
|
|
435
|
-
### Rule Files (.n2)
|
|
436
|
-
|
|
437
|
-
Safety rules are defined in `.n2` files in the `rules/` directory:
|
|
438
|
-
|
|
439
|
-
```n2
|
|
440
|
-
# Block catastrophic system destruction
|
|
441
|
-
@rule catastrophic_destruction {
|
|
442
|
-
scope: all
|
|
443
|
-
blacklist: [
|
|
444
|
-
/rm\s+-rf\s+\//,
|
|
445
|
-
/DROP\s+DATABASE/i,
|
|
446
|
-
/git\s+push\s+--force/i
|
|
447
|
-
]
|
|
448
|
-
requires: human_approval
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
# State machine: no payment without approval chain
|
|
452
|
-
@contract payment_sequence {
|
|
453
|
-
idle -> reviewing : on payment_request
|
|
454
|
-
reviewing -> approved : on payment_approval
|
|
455
|
-
approved -> executing : on execute_payment
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
# Named actions that always require approval
|
|
459
|
-
@gate high_risk_actions {
|
|
460
|
-
actions: [deploy_production, delete_database, send_email]
|
|
461
|
-
requires: human_approval
|
|
462
|
-
}
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
Three rule types:
|
|
466
|
-
|
|
467
|
-
| Type | Purpose | Example |
|
|
468
|
-
|------|---------|--------|
|
|
469
|
-
| `@rule` | Pattern blacklist | Block `rm -rf /`, `DROP DATABASE` |
|
|
470
|
-
| `@contract` | State machine | Enforce payment β approval β execute order |
|
|
471
|
-
| `@gate` | Named action gate | `send_email` always requires approval |
|
|
472
|
-
|
|
473
|
-
### Industry Templates
|
|
474
|
-
|
|
475
|
-
Soul ships with domain-specific rule templates in `lib/ark/examples/`:
|
|
476
|
-
|
|
477
|
-
| File | Domain | Key protections |
|
|
478
|
-
|------|--------|-----------------|
|
|
479
|
-
| `medical.n2` | Healthcare | Prescription/surgical sequences, patient data (HIPAA) |
|
|
480
|
-
| `military.n2` | Defense | Engagement protocols, nuclear dual-key, classified data |
|
|
481
|
-
| `financial.n2` | Finance | Payment sequences, transaction approval |
|
|
482
|
-
| `legal.n2` | Legal | Contract/litigation sequences |
|
|
483
|
-
| `privacy.n2` | Privacy | GDPR/CCPA, PII protection |
|
|
484
|
-
| `autonomous.n2` | Autonomous | Self-driving/drone safety |
|
|
485
|
-
| `system.n2` | DevOps | Deployment sequences, infrastructure |
|
|
486
|
-
|
|
487
|
-
Copy any template to `rules/` to activate:
|
|
488
|
-
```bash
|
|
489
|
-
cp lib/ark/examples/medical.n2 rules/
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
### Self-Protection (4 Layers)
|
|
493
|
-
|
|
494
|
-
Ark protects itself from being disabled by a rogue AI:
|
|
315
|
+
## π N2 Ecosystem
|
|
495
316
|
|
|
496
|
-
|
|
497
|
-
2. **Layer 2**: `delete/modify/disable n2-ark` β blocked
|
|
498
|
-
3. **Layer 3**: Core filenames (`gate.js`, `parser.js`) β blocked
|
|
499
|
-
4. **Layer 4**: Soul core files (`index.js`, `config`) β blocked
|
|
317
|
+
Soul works great standalone, but becomes even more powerful with the N2 ecosystem:
|
|
500
318
|
|
|
501
|
-
|
|
319
|
+
| Package | What it does | npm |
|
|
320
|
+
|---------|-------------|-----|
|
|
321
|
+
| [**Ark**](https://github.com/choihyunsus/n2-ark) | AI safety β blocks dangerous actions at zero token cost | `n2-ark` |
|
|
322
|
+
| [**Arachne**](https://github.com/choihyunsus/n2-arachne) | Code context assembly β 333x compression | `n2-arachne` |
|
|
323
|
+
| [**QLN**](https://github.com/choihyunsus/n2-QLN) | Tool routing β 1000+ tools β 1 router | `n2-qln` |
|
|
324
|
+
| [**Clotho**](https://github.com/choihyunsus/n2-clotho) | Rule compiler β `.n2` β SQL + state machines | `n2-clotho` |
|
|
502
325
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
Ark settings in `lib/config.default.js`:
|
|
506
|
-
|
|
507
|
-
```js
|
|
508
|
-
ARK: {
|
|
509
|
-
rulesDir: null, // null = soul/rules/ (default)
|
|
510
|
-
auditDir: null, // null = soul/data/ark-audit/
|
|
511
|
-
strictMode: false, // true = block unknown actions too
|
|
512
|
-
}
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
Override in `lib/config.local.js` to swap rule sets:
|
|
516
|
-
```js
|
|
517
|
-
module.exports = {
|
|
518
|
-
ARK: {
|
|
519
|
-
rulesDir: '/path/to/your/custom/rules', // Your industry rules
|
|
520
|
-
strictMode: true, // Maximum security
|
|
521
|
-
},
|
|
522
|
-
};
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
> **Note:** There is no `enabled: false` option. This is by design. The lock cannot unlock itself.
|
|
526
|
-
|
|
527
|
-
### Security Philosophy
|
|
528
|
-
|
|
529
|
-
**Transparency of `.n2` Rules**: Safety rules are **intentionally public and auditable**. This is by design β users should be able to read, customize, and verify exactly what is being blocked. There are no hidden rules, no obfuscated patterns, and no "trust us" black boxes. Open rules build trust.
|
|
530
|
-
|
|
531
|
-
**Secrets stay local**: `config.local.js` is gitignored and never distributed. It exists only on the user's machine. Soul does not transmit, store, or process any API keys, passwords, or credentials.
|
|
532
|
-
|
|
533
|
-
**Storage sovereignty**: All data (ledger, memory, audit logs) stays on **your machine**. You choose where backups go β local SQLite, Google Drive folder, or your own cloud. Soul never phones home.
|
|
534
|
-
|
|
535
|
-
**Defense in Depth**: For production use, pair Ark with OS-level read-only permissions on `.n2` rule files. Ark provides the active gate; the OS provides the final lock. No single layer is perfect β but together, they cover each other's gaps.
|
|
536
|
-
|
|
537
|
-
**Input Normalization** (v6.1.3): Ark normalizes all input before pattern matching β stripping backslash escapes (`r\m` β `rm`), collapsing whitespace, and removing quotes. Obfuscation attacks that trick simple regex are caught at the gate.
|
|
538
|
-
|
|
539
|
-
**Multi-Vector Defense** (v6.1.3): Ark now covers three additional attack vectors:
|
|
540
|
-
- **Script bypass** β blocks `bash *.sh`, `python *.py`, `eval()`, `child_process` (second-order execution)
|
|
541
|
-
- **Wildcard destruction** β blocks `rm *`, `find -delete`, `xargs rm` (self-protection bypass)
|
|
542
|
-
- **Command execution gate** β `@gate` on `execute_command`, `run_shell`, etc. (whitelist approach)
|
|
543
|
-
|
|
544
|
-
## Arachne β The Greatest Weaver
|
|
545
|
-
|
|
546
|
-
> *In Greek mythology, Arachne was a mortal weaver whose tapestries rivaled the gods. She wove exactly the right threads in exactly the right places.*
|
|
547
|
-
|
|
548
|
-
**Arachne** is Soul's code context assembly engine. It indexes your entire codebase and picks **exactly** the chunks your AI agent needs β no more, no less.
|
|
549
|
-
|
|
550
|
-
### The Problem
|
|
551
|
-
|
|
552
|
-
AI agents waste massive tokens reading irrelevant code:
|
|
553
|
-
|
|
554
|
-
| Approach | Tokens used | Relevance |
|
|
555
|
-
|----------|:----------:|:---------:|
|
|
556
|
-
| **Paste entire file** | 10,000+ | ~20% relevant |
|
|
557
|
-
| **Dump whole project** | 500,000+ | ~5% relevant |
|
|
558
|
-
| **Arachne** | ~14,000 | **~90% relevant** |
|
|
559
|
-
|
|
560
|
-
### Real-World Benchmark (N2 Browser Project)
|
|
561
|
-
|
|
562
|
-
| Metric | Value |
|
|
563
|
-
|--------|:-----:|
|
|
564
|
-
| **Project size** | 3,219 files, 4.68M tokens |
|
|
565
|
-
| **Arachne output** | 14,074 tokens |
|
|
566
|
-
| **Compression** | **333x** (99.7% reduction) |
|
|
567
|
-
| **Index time** | 627ms (incremental: 0ms) |
|
|
568
|
-
| **DB size** | 24 MB |
|
|
569
|
-
|
|
570
|
-
### How Arachne Works
|
|
571
|
-
|
|
572
|
-
```
|
|
573
|
-
Your 50,000-file project
|
|
574
|
-
β
|
|
575
|
-
ββββββ΄βββββ
|
|
576
|
-
β Index β β Scans all files, chunks by function/class
|
|
577
|
-
β (boot) β Incremental: only re-indexes changed files
|
|
578
|
-
ββββββ¬βββββ
|
|
579
|
-
β
|
|
580
|
-
ββββββ΄βββββ
|
|
581
|
-
β Search β β BM25 keyword search (+ optional semantic via Ollama)
|
|
582
|
-
β (query) β Finds the most relevant chunks across all files
|
|
583
|
-
ββββββ¬βββββ
|
|
584
|
-
β
|
|
585
|
-
ββββββ΄βββββ
|
|
586
|
-
β Assemble β β Picks top chunks within your token budget
|
|
587
|
-
β (budget) β 4 layers: fixed + short-term + associative + spare
|
|
588
|
-
ββββββ¬βββββ
|
|
589
|
-
β
|
|
590
|
-
30 most relevant
|
|
591
|
-
code chunks β AI
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
### Key Features
|
|
595
|
-
|
|
596
|
-
| Feature | Description |
|
|
597
|
-
|---------|------------|
|
|
598
|
-
| **Incremental Indexing** | Only re-indexes changed files (hash-based detection) |
|
|
599
|
-
| **Language-Aware Chunking** | Splits code by function/class boundaries, not arbitrary lines |
|
|
600
|
-
| **BM25 Search** | Fast keyword search with TF-IDF ranking |
|
|
601
|
-
| **Semantic Search** | Optional Ollama embeddings (nomic-embed-text) |
|
|
602
|
-
| **Token Budget Assembly** | Smart context assembly within configurable token limits |
|
|
603
|
-
| **4-Layer Assembly** | Fixed (10%) + Short-term (30%) + Associative (40%) + Spare (20%) |
|
|
604
|
-
| **17 Languages** | JS, TS, Python, Rust, Go, Java, C/C++, C#, Ruby, PHP, Swift, Kotlin |
|
|
605
|
-
| **12 Text Formats** | MD, JSON, YAML, XML, HTML, CSS, SQL, Shell scripts |
|
|
606
|
-
| **Backup/Restore** | Incremental backups with configurable retention |
|
|
607
|
-
|
|
608
|
-
### Configuration
|
|
609
|
-
|
|
610
|
-
Arachne settings in `lib/config.default.js`:
|
|
611
|
-
|
|
612
|
-
```js
|
|
613
|
-
ARACHNE: {
|
|
614
|
-
projectDir: null, // Set to your project root to enable
|
|
615
|
-
indexing: {
|
|
616
|
-
autoIndex: true, // Auto-index on boot
|
|
617
|
-
maxFileSize: 512 * 1024,
|
|
618
|
-
},
|
|
619
|
-
assembly: {
|
|
620
|
-
defaultBudget: 30000, // Token budget for context
|
|
621
|
-
},
|
|
622
|
-
embedding: {
|
|
623
|
-
enabled: false, // true = requires: ollama pull nomic-embed-text
|
|
624
|
-
},
|
|
625
|
-
}
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
### Usage
|
|
629
|
-
|
|
630
|
-
```
|
|
631
|
-
n2_arachne(action: "index") β Index your project files
|
|
632
|
-
n2_arachne(action: "search", query: "authentication JWT") β Search code
|
|
633
|
-
n2_arachne(action: "assemble", query: "how does auth work?", budget: 30000) β Full context assembly
|
|
634
|
-
n2_arachne(action: "status") β Check index status
|
|
635
|
-
n2_arachne(action: "backup") β Backup index DB
|
|
636
|
-
```
|
|
326
|
+
> Every package works **100% standalone**. Install only what you need.
|
|
637
327
|
|
|
638
|
-
>
|
|
328
|
+
> [!NOTE]
|
|
329
|
+
> **Migration from v7.x**: Ark and Arachne were previously bundled inside Soul. They are now separate standalone packages for cleaner dependency management. If you were using them, install them individually: `npm install n2-ark n2-arachne`
|
|
639
330
|
|
|
640
331
|
## Available Tools
|
|
641
332
|
|
|
@@ -660,7 +351,6 @@ n2_arachne(action: "backup") β Backup index DB
|
|
|
660
351
|
| `n2_kv_backup` | Backup to portable SQLite DB |
|
|
661
352
|
| `n2_kv_restore` | Restore from backup |
|
|
662
353
|
| `n2_kv_backup_list` | List backup history |
|
|
663
|
-
| `n2_arachne` | π Code context: index, search, assemble, backup, status (v7.0) |
|
|
664
354
|
|
|
665
355
|
## KV-Cache Progressive Loading
|
|
666
356
|
|
|
@@ -809,8 +499,6 @@ soul/
|
|
|
809
499
|
β β βββ ledger/ # Immutable work logs
|
|
810
500
|
β β βββ 2026/03/09/
|
|
811
501
|
β β βββ 001-agent.json
|
|
812
|
-
β βββ ark-audit/ # Ark block/pass logs β v6.0
|
|
813
|
-
β βββ arachne/ # Arachne index DB + embeddings β NEW v7.0
|
|
814
502
|
β βββ kv-cache/ # Session snapshots
|
|
815
503
|
β βββ snapshots/ # JSON backend
|
|
816
504
|
β βββ sqlite/ # SQLite backend
|
package/lib/config.default.js
CHANGED
|
@@ -77,62 +77,8 @@ module.exports = {
|
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
|
|
80
|
-
// Ark
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
rulesDir: null, // null = soul/rules/
|
|
84
|
-
auditDir: null, // null = soul/data/ark-audit/
|
|
85
|
-
strictMode: false, // true = block unknown actions too
|
|
86
|
-
auditMaxAgeDays: 7, // Auto-cleanup audit logs after N days
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
// Arachne β Code Context Assembly (optional).
|
|
90
|
-
// Set projectDir to enable. null = disabled.
|
|
91
|
-
ARACHNE: {
|
|
92
|
-
projectDir: null, // Set to project root to enable (e.g., '/path/to/my-project')
|
|
93
|
-
dataDir: null, // null = DATA_DIR/arachne/
|
|
94
|
-
indexing: {
|
|
95
|
-
autoIndex: true, // Auto-index on boot
|
|
96
|
-
incremental: true,
|
|
97
|
-
maxFileSize: 512 * 1024, // 512KB max per file
|
|
98
|
-
maxFiles: 50000,
|
|
99
|
-
chunkStrategy: 'regex',
|
|
100
|
-
tokenMultiplier: 3.5, // Chars per token. English/code: 3.5, CJK: 1.5
|
|
101
|
-
supportedLanguages: ['js', 'ts', 'jsx', 'tsx', 'py', 'rs', 'go', 'java', 'c', 'cpp', 'h', 'hpp', 'cs', 'rb', 'php', 'swift', 'kt'],
|
|
102
|
-
alsoIndexAsText: ['md', 'json', 'yaml', 'yml', 'toml', 'xml', 'html', 'css', 'sql', 'sh', 'bat', 'ps1'],
|
|
103
|
-
},
|
|
104
|
-
ignore: {
|
|
105
|
-
useGitignore: true,
|
|
106
|
-
useContextignore: true,
|
|
107
|
-
patterns: [
|
|
108
|
-
'node_modules/**', 'vendor/**', '__pycache__/**', '.venv/**',
|
|
109
|
-
'dist/**', 'build/**', 'out/**', '.next/**', 'target/**',
|
|
110
|
-
'.git/**',
|
|
111
|
-
'*.png', '*.jpg', '*.jpeg', '*.gif', '*.ico', '*.svg', '*.bmp', '*.webp',
|
|
112
|
-
'*.woff', '*.woff2', '*.ttf', '*.eot',
|
|
113
|
-
'*.mp3', '*.mp4', '*.wav', '*.avi', '*.mkv', '*.webm',
|
|
114
|
-
'*.zip', '*.tar', '*.gz', '*.rar', '*.7z',
|
|
115
|
-
'*.exe', '*.dll', '*.so', '*.dylib', '*.bin',
|
|
116
|
-
'*.min.js', '*.min.css', '*.map',
|
|
117
|
-
'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml',
|
|
118
|
-
'soul/data/**', 'data/**',
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
search: {
|
|
122
|
-
bm25: { k1: 1.2, b: 0.75 },
|
|
123
|
-
topK: 10,
|
|
124
|
-
},
|
|
125
|
-
assembly: {
|
|
126
|
-
defaultBudget: 30000, // Token budget for context assembly
|
|
127
|
-
layers: { fixed: 0.10, shortTerm: 0.30, associative: 0.40, spare: 0.20 },
|
|
128
|
-
dependencyDepth: 2,
|
|
129
|
-
},
|
|
130
|
-
backup: {},
|
|
131
|
-
embedding: {
|
|
132
|
-
enabled: false, // Requires Ollama with nomic-embed-text
|
|
133
|
-
provider: 'ollama',
|
|
134
|
-
model: 'nomic-embed-text',
|
|
135
|
-
endpoint: 'http://localhost:11434',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
80
|
+
// Ark & Arachne are now standalone packages:
|
|
81
|
+
// npm install n2-ark β https://github.com/choihyunsus/n2-ark
|
|
82
|
+
// npm install n2-arachne β https://github.com/choihyunsus/n2-arachne
|
|
138
83
|
};
|
|
84
|
+
|
package/package.json
CHANGED
package/lib/arachne/README.md
DELETED