@miriad-systems/nuum 0.1.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 +131 -0
- package/dist/index.js +47926 -0
- package/package.json +62 -0
- package/src/storage/migrations/0001_initial_schema.sql +73 -0
- package/src/storage/migrations/0002_add_fts_indexes.sql +55 -0
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@miriad-systems/nuum",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI coding agent with continuous memory - infinite context across sessions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"nuum": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"src/storage/migrations"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "bun build ./src/cli/index.ts --outdir ./dist --target node",
|
|
15
|
+
"dev": "bun run ./src/cli/index.ts",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "bun test",
|
|
18
|
+
"prepublishOnly": "bun run build && bun run typecheck",
|
|
19
|
+
"release": "bun run build && bun run typecheck && npm publish --access public"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"ai",
|
|
23
|
+
"agent",
|
|
24
|
+
"coding",
|
|
25
|
+
"memory",
|
|
26
|
+
"anthropic",
|
|
27
|
+
"claude",
|
|
28
|
+
"mcp"
|
|
29
|
+
],
|
|
30
|
+
"author": "Miriad Systems",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/simen/miriad-code.git"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@ai-sdk/anthropic": "^1.1.0",
|
|
41
|
+
"@anthropic-ai/sdk": "^0.39.0",
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
43
|
+
"@types/diff": "^7.0.2",
|
|
44
|
+
"ai": "^4.1.0",
|
|
45
|
+
"better-sqlite3": "^12.6.2",
|
|
46
|
+
"diff": "^8.0.3",
|
|
47
|
+
"drizzle-orm": "^0.38.0",
|
|
48
|
+
"ulid": "^2.3.0",
|
|
49
|
+
"zod": "^3.24.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
53
|
+
"@types/bun": "^1.1.0",
|
|
54
|
+
"drizzle-kit": "^0.30.0",
|
|
55
|
+
"tsx": "^4.21.0",
|
|
56
|
+
"typescript": "^5.7.0"
|
|
57
|
+
},
|
|
58
|
+
"acknowledgments": {
|
|
59
|
+
"letta": "Memory architecture patterns - three-tier memory, agent-editable memory, sleeptime workers",
|
|
60
|
+
"opencode": "Tool system, shell execution, permission system infrastructure"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
-- Initial schema for miriad-code
|
|
2
|
+
-- Creates all core tables for temporal, present, LTM, and worker tracking
|
|
3
|
+
|
|
4
|
+
CREATE TABLE IF NOT EXISTS temporal_messages (
|
|
5
|
+
id TEXT PRIMARY KEY,
|
|
6
|
+
type TEXT NOT NULL,
|
|
7
|
+
content TEXT NOT NULL,
|
|
8
|
+
token_estimate INTEGER NOT NULL,
|
|
9
|
+
created_at TEXT NOT NULL
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
CREATE INDEX IF NOT EXISTS idx_temporal_messages_created
|
|
13
|
+
ON temporal_messages(id);
|
|
14
|
+
|
|
15
|
+
CREATE TABLE IF NOT EXISTS temporal_summaries (
|
|
16
|
+
id TEXT PRIMARY KEY,
|
|
17
|
+
order_num INTEGER NOT NULL,
|
|
18
|
+
start_id TEXT NOT NULL,
|
|
19
|
+
end_id TEXT NOT NULL,
|
|
20
|
+
narrative TEXT NOT NULL,
|
|
21
|
+
key_observations TEXT NOT NULL,
|
|
22
|
+
tags TEXT NOT NULL DEFAULT '[]',
|
|
23
|
+
token_estimate INTEGER NOT NULL,
|
|
24
|
+
created_at TEXT NOT NULL
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
CREATE INDEX IF NOT EXISTS idx_temporal_summaries_order
|
|
28
|
+
ON temporal_summaries(order_num, id);
|
|
29
|
+
|
|
30
|
+
CREATE INDEX IF NOT EXISTS idx_temporal_summaries_range
|
|
31
|
+
ON temporal_summaries(start_id, end_id);
|
|
32
|
+
|
|
33
|
+
CREATE TABLE IF NOT EXISTS present_state (
|
|
34
|
+
id INTEGER PRIMARY KEY DEFAULT 1,
|
|
35
|
+
mission TEXT,
|
|
36
|
+
status TEXT,
|
|
37
|
+
tasks TEXT NOT NULL DEFAULT '[]'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE IF NOT EXISTS ltm_entries (
|
|
41
|
+
slug TEXT PRIMARY KEY,
|
|
42
|
+
parent_slug TEXT,
|
|
43
|
+
path TEXT NOT NULL,
|
|
44
|
+
title TEXT NOT NULL,
|
|
45
|
+
body TEXT NOT NULL,
|
|
46
|
+
links TEXT NOT NULL DEFAULT '[]',
|
|
47
|
+
version INTEGER NOT NULL DEFAULT 1,
|
|
48
|
+
created_by TEXT NOT NULL,
|
|
49
|
+
updated_by TEXT NOT NULL,
|
|
50
|
+
archived_at TEXT,
|
|
51
|
+
created_at TEXT NOT NULL,
|
|
52
|
+
updated_at TEXT NOT NULL
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
CREATE INDEX IF NOT EXISTS idx_ltm_entries_path
|
|
56
|
+
ON ltm_entries(path);
|
|
57
|
+
|
|
58
|
+
CREATE INDEX IF NOT EXISTS idx_ltm_entries_parent
|
|
59
|
+
ON ltm_entries(parent_slug);
|
|
60
|
+
|
|
61
|
+
CREATE TABLE IF NOT EXISTS workers (
|
|
62
|
+
id TEXT PRIMARY KEY,
|
|
63
|
+
type TEXT NOT NULL,
|
|
64
|
+
status TEXT NOT NULL,
|
|
65
|
+
started_at TEXT,
|
|
66
|
+
completed_at TEXT,
|
|
67
|
+
error TEXT
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
CREATE TABLE IF NOT EXISTS session_config (
|
|
71
|
+
key TEXT PRIMARY KEY,
|
|
72
|
+
value TEXT
|
|
73
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
-- Add FTS5 full-text search indexes for temporal messages and LTM entries
|
|
2
|
+
-- These enable the reflection agent to search conversation history
|
|
3
|
+
|
|
4
|
+
-- FTS5 virtual table for full-text search on temporal messages
|
|
5
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS temporal_messages_fts USING fts5(
|
|
6
|
+
id UNINDEXED,
|
|
7
|
+
type UNINDEXED,
|
|
8
|
+
content,
|
|
9
|
+
content=temporal_messages,
|
|
10
|
+
content_rowid=rowid
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- Triggers to keep FTS index in sync with temporal_messages
|
|
14
|
+
CREATE TRIGGER IF NOT EXISTS temporal_messages_ai AFTER INSERT ON temporal_messages BEGIN
|
|
15
|
+
INSERT INTO temporal_messages_fts(rowid, id, type, content)
|
|
16
|
+
VALUES (NEW.rowid, NEW.id, NEW.type, NEW.content);
|
|
17
|
+
END;
|
|
18
|
+
|
|
19
|
+
CREATE TRIGGER IF NOT EXISTS temporal_messages_ad AFTER DELETE ON temporal_messages BEGIN
|
|
20
|
+
INSERT INTO temporal_messages_fts(temporal_messages_fts, rowid, id, type, content)
|
|
21
|
+
VALUES ('delete', OLD.rowid, OLD.id, OLD.type, OLD.content);
|
|
22
|
+
END;
|
|
23
|
+
|
|
24
|
+
-- FTS5 virtual table for full-text search on LTM entries
|
|
25
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS ltm_entries_fts USING fts5(
|
|
26
|
+
slug UNINDEXED,
|
|
27
|
+
title,
|
|
28
|
+
body,
|
|
29
|
+
content=ltm_entries,
|
|
30
|
+
content_rowid=rowid
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
-- Triggers to keep FTS index in sync with ltm_entries
|
|
34
|
+
CREATE TRIGGER IF NOT EXISTS ltm_entries_ai AFTER INSERT ON ltm_entries BEGIN
|
|
35
|
+
INSERT INTO ltm_entries_fts(rowid, slug, title, body)
|
|
36
|
+
VALUES (NEW.rowid, NEW.slug, NEW.title, NEW.body);
|
|
37
|
+
END;
|
|
38
|
+
|
|
39
|
+
CREATE TRIGGER IF NOT EXISTS ltm_entries_au AFTER UPDATE ON ltm_entries BEGIN
|
|
40
|
+
INSERT INTO ltm_entries_fts(ltm_entries_fts, rowid, slug, title, body)
|
|
41
|
+
VALUES ('delete', OLD.rowid, OLD.slug, OLD.title, OLD.body);
|
|
42
|
+
INSERT INTO ltm_entries_fts(rowid, slug, title, body)
|
|
43
|
+
VALUES (NEW.rowid, NEW.slug, NEW.title, NEW.body);
|
|
44
|
+
END;
|
|
45
|
+
|
|
46
|
+
CREATE TRIGGER IF NOT EXISTS ltm_entries_ad AFTER DELETE ON ltm_entries BEGIN
|
|
47
|
+
INSERT INTO ltm_entries_fts(ltm_entries_fts, rowid, slug, title, body)
|
|
48
|
+
VALUES ('delete', OLD.rowid, OLD.slug, OLD.title, OLD.body);
|
|
49
|
+
END;
|
|
50
|
+
|
|
51
|
+
-- Rebuild FTS indexes to ensure they're in sync with base tables
|
|
52
|
+
-- This is idempotent - safe to run on existing databases
|
|
53
|
+
-- The 'rebuild' command repopulates the FTS index from the content table
|
|
54
|
+
INSERT INTO temporal_messages_fts(temporal_messages_fts) VALUES('rebuild');
|
|
55
|
+
INSERT INTO ltm_entries_fts(ltm_entries_fts) VALUES('rebuild');
|