spine-memory 0.2.0__tar.gz → 0.2.2__tar.gz
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.
- {spine_memory-0.2.0/spine_memory.egg-info → spine_memory-0.2.2}/PKG-INFO +332 -319
- {spine_memory-0.2.0 → spine_memory-0.2.2}/README.md +4 -3
- {spine_memory-0.2.0 → spine_memory-0.2.2}/pyproject.toml +15 -1
- {spine_memory-0.2.0 → spine_memory-0.2.2}/setup.cfg +4 -4
- {spine_memory-0.2.0 → spine_memory-0.2.2/spine_memory.egg-info}/PKG-INFO +332 -319
- {spine_memory-0.2.0 → spine_memory-0.2.2}/spine_memory.egg-info/SOURCES.txt +1 -0
- spine_memory-0.2.2/tests/test_smoke.py +200 -0
- spine_memory-0.2.2/tools/_critic_check.py +183 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_node_io.py +69 -2
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_quality_audit.py +7 -7
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_wander.py +3 -2
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/cli.py +4 -2
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/mcp_server.py +8 -7
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/night_daemon.py +25 -31
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/spine_preflight.py +3 -3
- spine_memory-0.2.0/tests/test_smoke.py +0 -96
- {spine_memory-0.2.0 → spine_memory-0.2.2}/LICENSE +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/spine_memory.egg-info/dependency_links.txt +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/spine_memory.egg-info/entry_points.txt +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/spine_memory.egg-info/requires.txt +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/spine_memory.egg-info/top_level.txt +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_build_index.py +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_check_anchors.py +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_crosslink.py +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_embed_links.py +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/_git_hook.py +0 -0
- {spine_memory-0.2.0 → spine_memory-0.2.2}/tools/benchmark_tokens.py +0 -0
|
@@ -1,319 +1,332 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: spine-memory
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Hierarchical Markdown/YAML graph memory for long-horizon AI agents — git-native, zero-token CI guardrails, no vector DB.
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
├──
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
├──
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
#
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
#
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
python tools/
|
|
284
|
-
|
|
285
|
-
#
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
#
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spine-memory
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Hierarchical Markdown/YAML graph memory for long-horizon AI agents — git-native, zero-token CI guardrails, no vector DB.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Scrimal/SPINE-Memory
|
|
7
|
+
Project-URL: Repository, https://github.com/Scrimal/SPINE-Memory
|
|
8
|
+
Project-URL: Documentation, https://github.com/Scrimal/SPINE-Memory/blob/main/methodology/SPINE_METHODOLOGY_EN.md
|
|
9
|
+
Project-URL: Issues, https://github.com/Scrimal/SPINE-Memory/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Scrimal/SPINE-Memory/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: memory,llm,ai-agent,markdown,knowledge-graph,mcp,provenance
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: mcp
|
|
27
|
+
Requires-Dist: fastmcp>=2.0.0; extra == "mcp"
|
|
28
|
+
Provides-Extra: tokens
|
|
29
|
+
Requires-Dist: tiktoken>=0.7.0; extra == "tokens"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: fastmcp>=2.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: tiktoken>=0.7.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# SPINE: Hierarchical Graph Memory for Long-Horizon AI Agents
|
|
36
|
+
|
|
37
|
+
> Read this in: [English](README.md) · [Русский](README_RU.md)
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
**SPINE** is a lightweight Markdown- and YAML-based cognitive memory framework
|
|
42
|
+
that gives LLM agents persistent, scalable, low-latency long-term memory without
|
|
43
|
+
heavy vector-database overhead.
|
|
44
|
+
|
|
45
|
+
Battle-tested on a real-world personal knowledge graph of **532 structured memory
|
|
46
|
+
nodes (~2.6M+ chars indexed)** and **460+ typed semantic links**, with schema
|
|
47
|
+
integrity enforced by deterministic, zero-token CI checks.
|
|
48
|
+
|
|
49
|
+
> Your IDE remembers **WHAT** is in the file. SPINE remembers **WHY** it's there — with receipts.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## SPINE in 60 seconds
|
|
54
|
+
|
|
55
|
+
**Dev / IDE.** Your coding agent spots a `sleep(200)` in a retry loop and reaches
|
|
56
|
+
to "clean it up". It runs `git blame`, finds the commit, then asks SPINE. SPINE
|
|
57
|
+
returns a post-mortem node: *"2026-03 rate-limit incident — the API returns 429
|
|
58
|
+
if we retry faster than 200 ms."* The agent leaves the line alone. No 3 AM page.
|
|
59
|
+
|
|
60
|
+
**Long-horizon agent.** An agent running 500+ sessions across months, with 2.6M+
|
|
61
|
+
chars of accumulated context, needs a decision from three months ago. It walks
|
|
62
|
+
the funnel — `impulse` (2 lines) → `summary` (5 sentences) → `cleaned_data` →
|
|
63
|
+
`source_base` — spending ~60 tokens on the first hop instead of loading the whole
|
|
64
|
+
corpus. Marginal cost: **~$0.01/node**.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## The Problem
|
|
69
|
+
|
|
70
|
+
Standard flat RAG degrades as a knowledge base grows past a few hundred documents:
|
|
71
|
+
|
|
72
|
+
- **Context bloat & token cost** — full raw chunks exhaust context windows with
|
|
73
|
+
logs, formatting noise, and boilerplate.
|
|
74
|
+
- **Loss of causality & chronology** — vector similarity misses temporal order
|
|
75
|
+
(`roots -> after`) and high-level thematic grouping.
|
|
76
|
+
- **Destructive compression** — summarization discards original data, blocking
|
|
77
|
+
forensic lookups and future fine-tuning.
|
|
78
|
+
- **Memory rot & hallucination** — without periodic consolidation and schema
|
|
79
|
+
validation, agent memory accumulates noise.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Core Architecture
|
|
84
|
+
|
|
85
|
+
SPINE organizes memory into a **3-tier cognitive topology** modeled after
|
|
86
|
+
biological neural organization:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
[ Tier 1: Domains — macro-areas ]
|
|
90
|
+
│
|
|
91
|
+
▼
|
|
92
|
+
[ Tier 2: Constellations — thematic clusters, 5–20 nodes ]
|
|
93
|
+
│
|
|
94
|
+
▼
|
|
95
|
+
[ Tier 3: SPINE Nodes — atomic memory units, ~5k chars each ]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Key mechanisms
|
|
99
|
+
|
|
100
|
+
1. **Deterministic ingestion & chunking.** Raw logs are pre-processed by
|
|
101
|
+
deterministic Python scripts into ~5,000-char Markdown chunks *before* touching
|
|
102
|
+
an LLM — cutting ingestion token cost and semantic load.
|
|
103
|
+
2. **Multi-layer progressive disclosure** (`Constellation` → `Impulse` →
|
|
104
|
+
`Summary` → `Cleaned` → `Raw`). The agent walks a relevance funnel instead of
|
|
105
|
+
loading raw chunks upfront:
|
|
106
|
+
- **Routing & scent** — filter by domain/constellation, scan 1–2-line
|
|
107
|
+
**impulses** and **anchors** inside candidate clusters.
|
|
108
|
+
- **Synthesis** — read the 3–5-sentence **summary** to confirm relevance.
|
|
109
|
+
- **Precision context** — load artifact-free **cleaned data**.
|
|
110
|
+
- **Lossless basement** — preserve the untouched original in **source_base**
|
|
111
|
+
(≥70% byte ratio) for forensic drill-down and future LoRA/QLoRA fine-tuning.
|
|
112
|
+
3. **Multi-dimensional navigation & Hebbian salience.**
|
|
113
|
+
- Chronological chains: `roots` → `after` with typed relations
|
|
114
|
+
(`:continuation`, `:genesis`, `:contrast`, …).
|
|
115
|
+
- Typed `semantic_links` + a compiled `reverse_index.json` for bidirectional
|
|
116
|
+
traversal without mutating existing YAML.
|
|
117
|
+
- `strategic_weight` (0.0–1.0), `access_count`, `last_accessed` keep active
|
|
118
|
+
memories hot while dormant ones cool without dead links.
|
|
119
|
+
4. **Zero-token deterministic guardrails.** `_critic_check.sh` and
|
|
120
|
+
`_quality_audit.py` enforce structure, length caps (`IMPULSE <= 2 lines`,
|
|
121
|
+
`SUMMARY <= 5 sentences`), anchor canon compliance, and `SOURCE_BASE >= 70%`
|
|
122
|
+
byte retention via instant bash/Python checks — no LLM-vs-LLM critic loops.
|
|
123
|
+
5. **Hybrid compute routing.** Designed for constrained edge hardware: local
|
|
124
|
+
embeddings on a Linux GPU, lightweight API models for routine extraction,
|
|
125
|
+
frontier models reserved strictly for deep synthesis.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Dev Overlay: memory *around* code
|
|
130
|
+
|
|
131
|
+
SPINE is not a symbol index — LSP, Tree-sitter and `ripgrep` already own that.
|
|
132
|
+
SPINE stores **intent**: why a decision was made, what broke, what traps exist.
|
|
133
|
+
One node type, four kinds, bound to code with a pointer to Git (not a copy of
|
|
134
|
+
the source):
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
kind: adr | postmortem | gotcha | contract
|
|
138
|
+
repo_ref: {path, commit, lines}
|
|
139
|
+
code_refs: ["src/auth/jwt.py::verify_token@a1b2c3d"]
|
|
140
|
+
status: active | superseded | historical # facts don't decay, they get superseded
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Dev tools:
|
|
144
|
+
|
|
145
|
+
- `spine_for_file(filepath)` — ADR / post-mortem / gotcha for a code file
|
|
146
|
+
- `spine_preflight --files ...` — what you might break *before* you change it
|
|
147
|
+
- `_git_hook.py --kind ...` — scaffold a memory node from a merged PR
|
|
148
|
+
(memory fills itself as a byproduct of normal work)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Graph scale & metrics
|
|
153
|
+
|
|
154
|
+
| Metric | Value |
|
|
155
|
+
| :--- | :--- |
|
|
156
|
+
| Production graph scale | 532 nodes (~2.6M+ chars indexed) |
|
|
157
|
+
| Typed semantic links | 460+ edges |
|
|
158
|
+
| Embedding links | 1496 (top-5, threshold 0.88) |
|
|
159
|
+
| YAML validity — production | 100% (532/532), enforced by `critic_check` |
|
|
160
|
+
| YAML validity — demo corpus | 100% (6/6 PASS) |
|
|
161
|
+
| Chunk granularity | ~5,000 chars |
|
|
162
|
+
| Retrieval strategy | progressive disclosure |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Human-Readable & Obsidian-Ready
|
|
167
|
+
|
|
168
|
+
Memory is plain Markdown in Git — open it in Obsidian, `grep` it, `diff` it,
|
|
169
|
+
read it with your own eyes. No black box, no "trust me, the vector said so".
|
|
170
|
+
|
|
171
|
+

|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Batch Ingestion & Staging Workflow
|
|
176
|
+
|
|
177
|
+
```mermaid
|
|
178
|
+
flowchart LR
|
|
179
|
+
A[Raw Chunk] --> B[Temp Staging]
|
|
180
|
+
B --> C{Zero-Token Critic}
|
|
181
|
+
C -- PASS --> D[Atomic Commit]
|
|
182
|
+
C -- FAIL --> B
|
|
183
|
+
D --> E[Context Compaction<br/>every 5 nodes]
|
|
184
|
+
E --> F[Next Chunk]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The agent writes each node draft into a temporary buffer (`TEMP`), runs
|
|
188
|
+
`_critic_check.sh` on it, resolves boundary cases on its own with bounded
|
|
189
|
+
discretion (e.g. a short source chunk, or a decimal point miscounted as a
|
|
190
|
+
sentence terminator) without looping in self-criticism, and only then atomically
|
|
191
|
+
commits the valid node into the production graph. Every 5 nodes the heavy
|
|
192
|
+
context is compacted into lightweight snapshots.
|
|
193
|
+
|
|
194
|
+
This staging discipline enables ingesting **40+ raw nodes in a row (500k+
|
|
195
|
+
tokens)** in a single session without degradation, at a marginal cost of
|
|
196
|
+
**~$0.01/node** (deterministic validation is token-free; only the final write
|
|
197
|
+
consumes model tokens).
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Repository structure
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
.
|
|
205
|
+
├── pyproject.toml # pip package (zero required deps)
|
|
206
|
+
├── README.md
|
|
207
|
+
├── README_RU.md
|
|
208
|
+
├── SKILL.md # agent skill (Pi, Claude Code, Cursor)
|
|
209
|
+
├── requirements.txt # optional deps (fastmcp, tiktoken)
|
|
210
|
+
├── assets/
|
|
211
|
+
│ └── graph_dark.png # Obsidian graph screenshot
|
|
212
|
+
├── methodology/
|
|
213
|
+
│ ├── SPINE_METHODOLOGY.md # format spec (RU)
|
|
214
|
+
│ └── SPINE_METHODOLOGY_EN.md # format spec (EN)
|
|
215
|
+
├── raw/
|
|
216
|
+
│ ├── U001.md # raw chunk #1
|
|
217
|
+
│ ├── U002.md # raw chunk #2
|
|
218
|
+
│ └── U003.md # raw chunk #3
|
|
219
|
+
├── nodes/
|
|
220
|
+
│ ├── KEDR_001.md # processed node (domain «Связь»)
|
|
221
|
+
│ ├── KEDR_002.md # processed node (domain «Карта»)
|
|
222
|
+
│ └── KEDR_003.md # processed node (domain «Тайны_Груза»)
|
|
223
|
+
├── anchors/
|
|
224
|
+
│ └── anchor_dump.json # anchor canon for the demo graph
|
|
225
|
+
└── tools/ # validation & traversal utilities
|
|
226
|
+
├── cli.py # spine CLI entry point
|
|
227
|
+
├── _node_io.py # canonical node reader/writer
|
|
228
|
+
├── _critic_check.sh
|
|
229
|
+
├── _check_anchors.py
|
|
230
|
+
├── _crosslink.py
|
|
231
|
+
├── _wander.py
|
|
232
|
+
├── _quality_audit.py
|
|
233
|
+
├── _build_index.py # rebuild reverse_index + anchor canon
|
|
234
|
+
├── _embed_links.py # import precomputed embedding links
|
|
235
|
+
├── spine_preflight.py # context radar for changed files
|
|
236
|
+
├── _git_hook.py # PR -> node scaffold
|
|
237
|
+
├── night_daemon.py # nightly consolidation + self-audit
|
|
238
|
+
├── mcp_server.py # MCP server (FastMCP)
|
|
239
|
+
└── benchmark_tokens.py # token savings benchmark
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The demo corpus (`KEDR_001..006`) is written in **Russian** to verify Cyrillic
|
|
243
|
+
tokenization and semantic anchors. All tools and the schema are
|
|
244
|
+
language-agnostic. The full story is told as a longread in
|
|
245
|
+
[`docs/longread.md`](docs/longread.md) — each chapter maps to one SPINE mechanic.
|
|
246
|
+
|
|
247
|
+
Raw chunks are named `U<number>.md` and paired with `nodes/<ID>.md` by the
|
|
248
|
+
trailing number (`U001` ↔ `KEDR_001`).
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Quickstart
|
|
253
|
+
|
|
254
|
+
Install and try it in 60 seconds:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pip install spine-memory # core (zero required deps)
|
|
258
|
+
pip install spine-memory[mcp] # + MCP server (fastmcp)
|
|
259
|
+
|
|
260
|
+
spine init --preset dev # scaffold .spine/ inside your repo
|
|
261
|
+
spine index # rebuild reverse_index.json
|
|
262
|
+
spine wander --from ADR_001 # walk the graph
|
|
263
|
+
spine mcp # start the MCP server
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Or run directly from a checkout (no install):
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# 1. Auto-audit nodes (clean PASS expected)
|
|
270
|
+
bash tools/_critic_check.sh nodes raw anchors/anchor_dump.json
|
|
271
|
+
|
|
272
|
+
# 2. Validate anchors against the canon
|
|
273
|
+
python tools/_check_anchors.py nodes/KEDR_001.md --dump anchors/anchor_dump.json --quiet
|
|
274
|
+
|
|
275
|
+
# 3. Walk the graph (forward and backlinks)
|
|
276
|
+
python tools/_wander.py --from KEDR_001 --hops 2 --folder nodes
|
|
277
|
+
|
|
278
|
+
# 4. Global quality audit
|
|
279
|
+
python tools/_quality_audit.py --nodes nodes --raw raw
|
|
280
|
+
|
|
281
|
+
# 5. Crosslink generation (dry run / apply)
|
|
282
|
+
python tools/_crosslink.py --folder nodes
|
|
283
|
+
python tools/_crosslink.py --folder nodes --apply
|
|
284
|
+
|
|
285
|
+
# 6. MCP server (stdio, for Claude Desktop / Cursor / Windsurf)
|
|
286
|
+
pip install -r requirements.txt
|
|
287
|
+
python tools/mcp_server.py
|
|
288
|
+
|
|
289
|
+
# 7. Token savings benchmark
|
|
290
|
+
python tools/benchmark_tokens.py
|
|
291
|
+
|
|
292
|
+
# 8. Rebuild reverse index + refresh anchor canon
|
|
293
|
+
python tools/_build_index.py
|
|
294
|
+
|
|
295
|
+
# 9. Nightly consolidation + self-audit
|
|
296
|
+
python tools/night_daemon.py --folder nodes
|
|
297
|
+
|
|
298
|
+
# 10. Import precomputed embedding links (from an external GPU worker)
|
|
299
|
+
python tools/_embed_links.py --input embed_links.json --folder nodes
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Node format (v2.1)
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
--- # YAML frontmatter
|
|
308
|
+
id: KEDR_001
|
|
309
|
+
type: spine_node
|
|
310
|
+
domain: Связь
|
|
311
|
+
hub: "[[Кедр_Связь]]"
|
|
312
|
+
constellation: Кедр-9 Expedition
|
|
313
|
+
vectors:
|
|
314
|
+
- "связь::трёхслойный_архив" # comment required
|
|
315
|
+
search_anchors:
|
|
316
|
+
- трёхслойный_архив
|
|
317
|
+
chronology:
|
|
318
|
+
roots: "[[U001]]"
|
|
319
|
+
after: "[[KEDR_002]]:continuation"
|
|
320
|
+
semantic_links:
|
|
321
|
+
- "[[KEDR_002]]::продолжение"
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
# IMPULSE — 1–2 lines
|
|
325
|
+
# SUMMARY — 3–5 sentences
|
|
326
|
+
# CLEANED_DATA — ~25 lines of facts
|
|
327
|
+
# IMPACT — strategic_weight + key_insight
|
|
328
|
+
# SOURCE_BASE — ≥70% of the raw source
|
|
329
|
+
---
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Full specification: `methodology/SPINE_METHODOLOGY_EN.md` (RU: `methodology/SPINE_METHODOLOGY.md`).
|