omnimemory-cli 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/bin/omnimemory +5 -0
- package/db/schema.sql +78 -0
- package/docs/quickstart-10min.md +47 -0
- package/omnimemory/__init__.py +2 -0
- package/omnimemory/adapters.py +123 -0
- package/omnimemory/cli.py +579 -0
- package/omnimemory/core.py +826 -0
- package/omnimemory/webui.py +419 -0
- package/package.json +37 -0
- package/scripts/attach_project.sh +25 -0
- package/scripts/bootstrap.sh +77 -0
- package/scripts/detach_project.sh +21 -0
- package/scripts/install.sh +94 -0
- package/scripts/uninstall.sh +13 -0
- package/scripts/verify_phase_a.sh +52 -0
- package/scripts/verify_phase_b.sh +21 -0
- package/scripts/verify_phase_c.sh +19 -0
- package/scripts/verify_phase_d.sh +28 -0
- package/spec/changelog.md +14 -0
- package/spec/memory-envelope.schema.json +111 -0
- package/spec/memory-event.schema.json +31 -0
- package/spec/protocol.md +78 -0
- package/templates/project-minimal/.omni-memory-ignore +8 -0
- package/templates/project-minimal/.omni-memory-session.md +13 -0
- package/templates/project-minimal/.omni-memory.json +10 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
TARGET_HOME="${OMNIMEMORY_HOME:-$HOME/.omnimemory}"
|
|
5
|
+
CONFIG_FILE="$TARGET_HOME/omnimemory.config.json"
|
|
6
|
+
|
|
7
|
+
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
8
|
+
echo "No OmniMemory install found at: $TARGET_HOME"
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
rm -rf "$TARGET_HOME"
|
|
13
|
+
echo "Removed OmniMemory install at: $TARGET_HOME"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
required_files=(
|
|
7
|
+
"README.md"
|
|
8
|
+
"docs/architecture.md"
|
|
9
|
+
"docs/decisions.md"
|
|
10
|
+
"docs/integration-spec.md"
|
|
11
|
+
"docs/sync-and-adapters.md"
|
|
12
|
+
"docs/phase-workflow.md"
|
|
13
|
+
"docs/install-uninstall.md"
|
|
14
|
+
"docs/webui-plan.md"
|
|
15
|
+
"spec/protocol.md"
|
|
16
|
+
"spec/memory-envelope.schema.json"
|
|
17
|
+
"spec/memory-event.schema.json"
|
|
18
|
+
"db/schema.sql"
|
|
19
|
+
"scripts/install.sh"
|
|
20
|
+
"scripts/uninstall.sh"
|
|
21
|
+
"scripts/attach_project.sh"
|
|
22
|
+
"scripts/detach_project.sh"
|
|
23
|
+
"templates/project-minimal/.omni-memory.json"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
missing=0
|
|
27
|
+
for f in "${required_files[@]}"; do
|
|
28
|
+
if [[ ! -f "$ROOT_DIR/$f" ]]; then
|
|
29
|
+
echo "[FAIL] missing $f"
|
|
30
|
+
missing=1
|
|
31
|
+
fi
|
|
32
|
+
done
|
|
33
|
+
|
|
34
|
+
if [[ $missing -ne 0 ]]; then
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo "[OK] required files present"
|
|
39
|
+
|
|
40
|
+
if command -v sqlite3 >/dev/null 2>&1; then
|
|
41
|
+
tmpdb="$(mktemp "${TMPDIR:-/tmp}/omnimemory.verify.XXXXXX.db")"
|
|
42
|
+
sqlite3 "$tmpdb" < "$ROOT_DIR/db/schema.sql"
|
|
43
|
+
table_count="$(sqlite3 "$tmpdb" "SELECT count(*) FROM sqlite_master WHERE type IN ('table','view');")"
|
|
44
|
+
signal_col_count="$(sqlite3 "$tmpdb" "SELECT count(*) FROM pragma_table_info('memories') WHERE name IN ('importance_score','confidence_score','stability_score','reuse_count','volatility_score');")"
|
|
45
|
+
rm -f "$tmpdb"
|
|
46
|
+
echo "[OK] sqlite schema applies, table/view count=$table_count"
|
|
47
|
+
echo "[OK] memory signals columns count=$signal_col_count"
|
|
48
|
+
else
|
|
49
|
+
echo "[WARN] sqlite3 not found; schema apply check skipped"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
echo "[OK] Phase A verification completed"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
required_files=(
|
|
7
|
+
"omnimemory/cli.py"
|
|
8
|
+
"omnimemory/core.py"
|
|
9
|
+
"bin/omnimemory"
|
|
10
|
+
"tests/test_cli_mvp.sh"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
for f in "${required_files[@]}"; do
|
|
14
|
+
[[ -f "$ROOT_DIR/$f" ]] || { echo "[FAIL] missing $f"; exit 1; }
|
|
15
|
+
done
|
|
16
|
+
|
|
17
|
+
echo "[OK] phase-b files present"
|
|
18
|
+
|
|
19
|
+
bash "$ROOT_DIR/tests/test_cli_mvp.sh"
|
|
20
|
+
|
|
21
|
+
echo "[OK] Phase B verification completed"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
required_files=(
|
|
7
|
+
"omnimemory/adapters.py"
|
|
8
|
+
"tests/test_phase_c_adapters.sh"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
for f in "${required_files[@]}"; do
|
|
12
|
+
[[ -f "$ROOT_DIR/$f" ]] || { echo "[FAIL] missing $f"; exit 1; }
|
|
13
|
+
done
|
|
14
|
+
|
|
15
|
+
echo "[OK] phase-c files present"
|
|
16
|
+
|
|
17
|
+
bash "$ROOT_DIR/tests/test_phase_c_adapters.sh"
|
|
18
|
+
|
|
19
|
+
echo "[OK] Phase C verification completed"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
required_files=(
|
|
7
|
+
"omnimemory/webui.py"
|
|
8
|
+
"tests/test_phase_d_webui.sh"
|
|
9
|
+
"scripts/bootstrap.sh"
|
|
10
|
+
"tests/test_bootstrap.sh"
|
|
11
|
+
"tests/test_bootstrap_cli_cmd.sh"
|
|
12
|
+
"tests/test_uninstall_cli.sh"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
for f in "${required_files[@]}"; do
|
|
16
|
+
[[ -f "$ROOT_DIR/$f" ]] || { echo "[FAIL] missing $f"; exit 1; }
|
|
17
|
+
done
|
|
18
|
+
|
|
19
|
+
echo "[OK] phase-d files present"
|
|
20
|
+
|
|
21
|
+
python3 -m py_compile "$ROOT_DIR/omnimemory/webui.py"
|
|
22
|
+
|
|
23
|
+
bash "$ROOT_DIR/tests/test_phase_d_webui.sh"
|
|
24
|
+
bash "$ROOT_DIR/tests/test_bootstrap.sh"
|
|
25
|
+
bash "$ROOT_DIR/tests/test_bootstrap_cli_cmd.sh"
|
|
26
|
+
bash "$ROOT_DIR/tests/test_uninstall_cli.sh"
|
|
27
|
+
|
|
28
|
+
echo "[OK] Phase D verification completed"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Schema Changelog
|
|
2
|
+
|
|
3
|
+
## v0.1.0 (2026-02-08)
|
|
4
|
+
|
|
5
|
+
- 初始化 `MemoryEnvelope` 与 `MemoryEvent` schema。
|
|
6
|
+
- 定义四层记忆模型与事件类型。
|
|
7
|
+
- 约束凭据引用格式,禁止明文密钥。
|
|
8
|
+
- 新增 `signals` 字段:
|
|
9
|
+
- `importance_score`
|
|
10
|
+
- `confidence_score`
|
|
11
|
+
- `stability_score`
|
|
12
|
+
- `reuse_count`
|
|
13
|
+
- `volatility_score`
|
|
14
|
+
- SQLite `memories` 表新增上述信号列与索引,用于分层提升/降级决策。
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://omnimemory.dev/schema/memory-envelope.schema.json",
|
|
4
|
+
"title": "MemoryEnvelope",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"id",
|
|
8
|
+
"schema_version",
|
|
9
|
+
"created_at",
|
|
10
|
+
"updated_at",
|
|
11
|
+
"layer",
|
|
12
|
+
"kind",
|
|
13
|
+
"summary",
|
|
14
|
+
"body_md_path",
|
|
15
|
+
"tags",
|
|
16
|
+
"refs",
|
|
17
|
+
"signals",
|
|
18
|
+
"cred_refs",
|
|
19
|
+
"source",
|
|
20
|
+
"scope",
|
|
21
|
+
"integrity"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"id": { "type": "string", "minLength": 8 },
|
|
25
|
+
"schema_version": { "type": "string" },
|
|
26
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
27
|
+
"updated_at": { "type": "string", "format": "date-time" },
|
|
28
|
+
"layer": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"enum": ["instant", "short", "long", "archive"]
|
|
31
|
+
},
|
|
32
|
+
"kind": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["note", "decision", "task", "checkpoint", "summary", "evidence"]
|
|
35
|
+
},
|
|
36
|
+
"summary": { "type": "string", "minLength": 1 },
|
|
37
|
+
"body_md_path": { "type": "string", "minLength": 1 },
|
|
38
|
+
"tags": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": { "type": "string" },
|
|
41
|
+
"default": []
|
|
42
|
+
},
|
|
43
|
+
"refs": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": ["type", "target"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"type": { "type": "string", "enum": ["memory", "file", "url", "notion", "r2"] },
|
|
50
|
+
"target": { "type": "string" },
|
|
51
|
+
"note": { "type": "string" }
|
|
52
|
+
},
|
|
53
|
+
"additionalProperties": false
|
|
54
|
+
},
|
|
55
|
+
"default": []
|
|
56
|
+
},
|
|
57
|
+
"signals": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"required": [
|
|
60
|
+
"importance_score",
|
|
61
|
+
"confidence_score",
|
|
62
|
+
"stability_score",
|
|
63
|
+
"reuse_count",
|
|
64
|
+
"volatility_score"
|
|
65
|
+
],
|
|
66
|
+
"properties": {
|
|
67
|
+
"importance_score": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
68
|
+
"confidence_score": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
69
|
+
"stability_score": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
70
|
+
"reuse_count": { "type": "integer", "minimum": 0 },
|
|
71
|
+
"volatility_score": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
72
|
+
},
|
|
73
|
+
"additionalProperties": false
|
|
74
|
+
},
|
|
75
|
+
"cred_refs": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": { "type": "string", "pattern": "^(op|env|aws-sm|gcp-sm)://.+" },
|
|
78
|
+
"default": []
|
|
79
|
+
},
|
|
80
|
+
"source": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"required": ["tool", "session_id"],
|
|
83
|
+
"properties": {
|
|
84
|
+
"tool": { "type": "string" },
|
|
85
|
+
"account": { "type": "string" },
|
|
86
|
+
"device": { "type": "string" },
|
|
87
|
+
"session_id": { "type": "string" }
|
|
88
|
+
},
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
},
|
|
91
|
+
"scope": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"required": ["project_id"],
|
|
94
|
+
"properties": {
|
|
95
|
+
"project_id": { "type": "string" },
|
|
96
|
+
"workspace": { "type": "string" }
|
|
97
|
+
},
|
|
98
|
+
"additionalProperties": false
|
|
99
|
+
},
|
|
100
|
+
"integrity": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"required": ["content_sha256", "envelope_version"],
|
|
103
|
+
"properties": {
|
|
104
|
+
"content_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
105
|
+
"envelope_version": { "type": "integer", "minimum": 1 }
|
|
106
|
+
},
|
|
107
|
+
"additionalProperties": false
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"additionalProperties": false
|
|
111
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://omnimemory.dev/schema/memory-event.schema.json",
|
|
4
|
+
"title": "MemoryEvent",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"event_id",
|
|
8
|
+
"event_type",
|
|
9
|
+
"event_time",
|
|
10
|
+
"memory_id",
|
|
11
|
+
"payload"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"event_id": { "type": "string", "minLength": 8 },
|
|
15
|
+
"event_type": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"enum": [
|
|
18
|
+
"memory.write",
|
|
19
|
+
"memory.update",
|
|
20
|
+
"memory.checkpoint",
|
|
21
|
+
"memory.promote",
|
|
22
|
+
"memory.verify",
|
|
23
|
+
"memory.sync"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"event_time": { "type": "string", "format": "date-time" },
|
|
27
|
+
"memory_id": { "type": "string", "minLength": 8 },
|
|
28
|
+
"payload": { "type": "object" }
|
|
29
|
+
},
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
}
|
package/spec/protocol.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# OmniMemory 协议规范 v0.1.0
|
|
2
|
+
|
|
3
|
+
## 1. 版本与兼容
|
|
4
|
+
|
|
5
|
+
- 协议版本:`0.1.0`
|
|
6
|
+
- 语义化版本:
|
|
7
|
+
- `MAJOR`:不兼容结构变更
|
|
8
|
+
- `MINOR`:向后兼容新增字段
|
|
9
|
+
- `PATCH`:文档/实现修复
|
|
10
|
+
|
|
11
|
+
## 2. 统一记录模型(Memory Envelope)
|
|
12
|
+
|
|
13
|
+
字段(必填):
|
|
14
|
+
|
|
15
|
+
- `id` string
|
|
16
|
+
- `schema_version` string
|
|
17
|
+
- `created_at` string(ISO8601)
|
|
18
|
+
- `updated_at` string(ISO8601)
|
|
19
|
+
- `layer` enum: `instant|short|long|archive`
|
|
20
|
+
- `kind` enum: `note|decision|task|checkpoint|summary|evidence`
|
|
21
|
+
- `summary` string
|
|
22
|
+
- `body_md_path` string
|
|
23
|
+
- `tags` array[string]
|
|
24
|
+
- `refs` array[object]
|
|
25
|
+
- `signals` object
|
|
26
|
+
- `cred_refs` array[string]
|
|
27
|
+
- `source` object
|
|
28
|
+
- `scope` object
|
|
29
|
+
- `integrity` object
|
|
30
|
+
|
|
31
|
+
`signals` 字段:
|
|
32
|
+
|
|
33
|
+
- `importance_score` number [0,1]
|
|
34
|
+
- `confidence_score` number [0,1]
|
|
35
|
+
- `stability_score` number [0,1]
|
|
36
|
+
- `reuse_count` integer >= 0
|
|
37
|
+
- `volatility_score` number [0,1]
|
|
38
|
+
|
|
39
|
+
约束:
|
|
40
|
+
|
|
41
|
+
- `cred_refs` 不能包含密钥明文。
|
|
42
|
+
- `body_md_path` 必须是仓库内相对路径。
|
|
43
|
+
- `integrity.content_sha256` 对应 Markdown 正文哈希。
|
|
44
|
+
|
|
45
|
+
## 3. JSONL 事件模型
|
|
46
|
+
|
|
47
|
+
每行一个事件对象,事件类型:
|
|
48
|
+
|
|
49
|
+
- `memory.write`
|
|
50
|
+
- `memory.update`
|
|
51
|
+
- `memory.checkpoint`
|
|
52
|
+
- `memory.promote`
|
|
53
|
+
- `memory.verify`
|
|
54
|
+
- `memory.sync`
|
|
55
|
+
|
|
56
|
+
字段(必填):
|
|
57
|
+
|
|
58
|
+
- `event_id`
|
|
59
|
+
- `event_type`
|
|
60
|
+
- `event_time`
|
|
61
|
+
- `memory_id`
|
|
62
|
+
- `payload`
|
|
63
|
+
|
|
64
|
+
## 4. SQLite 模式约束
|
|
65
|
+
|
|
66
|
+
- `memories`:主表,存 envelope 元数据与 signals。
|
|
67
|
+
- `memory_refs`:引用关系。
|
|
68
|
+
- `memory_events`:事件流水。
|
|
69
|
+
- `memories_fts`:FTS5 检索 `summary` + `body_text`。
|
|
70
|
+
|
|
71
|
+
SQLite 可重建原则:
|
|
72
|
+
- 删除 SQLite 文件后,系统可从 Markdown + JSONL 重建索引。
|
|
73
|
+
|
|
74
|
+
## 5. 审计与迁移
|
|
75
|
+
|
|
76
|
+
- 每次 schema 升级都记录 `spec/changelog.md`。
|
|
77
|
+
- 提供迁移脚本(Phase B+)。
|
|
78
|
+
- 事件日志不可覆盖,仅追加。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# OmniMemory Session Entry
|
|
2
|
+
|
|
3
|
+
- Current phase:
|
|
4
|
+
- Current objective:
|
|
5
|
+
- Last checkpoint ID:
|
|
6
|
+
- Open risks:
|
|
7
|
+
- Next action:
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
1. Run `omnimemory brief --project <project_id>`
|
|
12
|
+
2. Review top 3 recent checkpoints
|
|
13
|
+
3. Continue task or start a new session
|