spool-memory 0.1.0

Local-first developer memory system — persistent, structured knowledge for AI coding tools
Documentation
1
2
3
4
5
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
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# Wake-Up Packet

## Goal

A wake-up packet is a stable, compact, explainable context bundle that helps an AI client quickly recover the most important developer, project, and task context without scanning the full vault.

It is the first structured output that turns `spool` from a note retriever into a cross-AI memory gateway.

## Design Principles

1. local-first and deterministic
2. explainable over magical
3. derived from trusted sources when possible
4. sensitivity-aware by default
5. shaped for multiple AI clients without changing the underlying meaning

## Non-Goals

Wake-up packets are not:

- a replacement for full note retrieval
- a raw event ledger export
- a long-form memory compression format
- a hidden policy engine

They should be treated as a fast-start layer that points the client toward the right durable context.

## Packet Types

The initial version supports two packet profiles:

1. developer wake-up packet
2. project wake-up packet

A future version may add:

- repo-session packet
- task handoff packet
- incident response packet

## Packet Contract

A wake-up packet should be represented as a structured object with these top-level fields:

```json
{
  "version": "wakeup.v1",
  "generated_at": "2026-04-08T15:00:00Z",
  "target": "claude",
  "profile": "project",
  "query": {
    "task": "design MCP interface",
    "cwd": "/Users/long/Work/spool",
    "files": ["src/app.rs"]
  },
  "identity": {},
  "working_style": {},
  "active_context": {},
  "priorities": [],
  "constraints": [],
  "decisions": [],
  "incidents": [],
  "recommended_notes": [],
  "provenance": {},
  "policy": {}
}
```

## Top-Level Fields

### `version`

Packet schema version. Start with `wakeup.v1`.

### `generated_at`

UTC timestamp for traceability and stale-context detection.

### `target`

The intended AI client or shaping profile.

Suggested initial values:

- `claude`
- `codex`
- `opencode`
- `generic`

### `profile`

The packet intent.

Suggested initial values:

- `developer`
- `project`

### `query`

The routing input that caused the packet to be generated.

Fields:

- `task`
- `cwd`
- `files`
- optional `modules`
- optional `scenes`

### `identity`

Stable identity facts that help a client orient quickly.

For a developer packet, examples include:

- role
- primary languages
- preferred collaboration style
- default review style

For a project packet, examples include:

- `project_id`
- project name
- repository roots
- major domains
- architecture summary

### `working_style`

Durable preferences that change how the client should behave.

Examples:

- prefer terse replies
- explain architectural changes before coding
- avoid destructive actions without confirmation
- prefer local-first and explicit provenance

This field should prioritize `memory_type: preference` and `memory_type: workflow` notes.

### `active_context`

The current project situation relevant to the query.

Examples:

- current phase or initiative
- active migration or refactor
- known open gaps
- current stack or architectural boundary

This field should prioritize `memory_type: project` and `memory_type: constraint` notes.

### `priorities`

A short ordered list of the most important things to optimize for right now.

Examples:

- keep Obsidian as curated truth
- expose stable tool interface before daemonizing
- avoid mixing raw ledger events with curated memory

### `constraints`

Hard requirements or boundaries that should shape later actions.

Each item should follow this structure:

```json
{
  "title": "Obsidian remains curated source of truth",
  "summary": "Raw captured session memory must not be written directly into curated notes.",
  "sensitivity": "internal",
  "source": "10-Projects/spool/Constraints.md"
}
```

This field should prioritize `memory_type: constraint` notes and source-of-truth notes.

### `decisions`

Important accepted decisions relevant to the current query.

Each item should include:

- decision title
- short rationale
- reversal condition if known
- source note or ADR

This field should prioritize `memory_type: decision` notes.

### `incidents`

Important failures or pitfalls that should change how the client proceeds.

Each item should include:

- incident summary
- consequence
- prevention or caution
- source note

This field should prioritize `memory_type: incident` notes.

### `recommended_notes`

The highest-value notes the client should fetch or inspect next.

Each item should include:

- `path`
- `title`
- `memory_type`
- `why_relevant`
- `score`

This field bridges wake-up packets and normal retrieval.

### `provenance`

Explains where packet content came from.

Suggested shape:

```json
{
  "derived_from": [
    {
      "path": "10-Projects/spool/Project Overview.md",
      "source_of_truth": true,
      "memory_type": "project"
    }
  ],
  "selection_basis": [
    "project_id matched spool",
    "memory_type constraint boosted score",
    "source_of_truth boosted retrieval"
  ]
}
```

### `policy`

Summarizes output filtering that affected the packet.

Suggested fields:

- `max_sensitivity_included`
- `redactions_applied`
- `suppressed_note_count`
- `policy_mode`

This should make the packet explainable when later policy controls become stricter.

## Source Selection Rules

Wake-up packets should not summarize the whole vault. They should be assembled from a constrained candidate set.

Recommended selection order:

### Project packet

1. route project using `cwd`
2. scan only configured project `note_roots`
3. score notes using the existing retrieval engine
4. hard-filter by packet profile and sensitivity policy
5. promote top notes into packet sections by `memory_type`
6. keep only a small number of entries per section

### Developer packet

Developer packets should not depend only on project routing.

They should draw from a merged candidate set:

1. global developer roots such as `00-Identity`, `20-Areas`, `30-Workflows`
2. optionally, the matched project's `note_roots` for project-scoped preferences or constraints
3. the same scoring core, followed by packet-profile filtering and sensitivity policy

This keeps the builder aligned with the current routing and ranking core while allowing durable cross-project preferences to appear in developer-oriented packets.

Suggested first-pass limits:

- `working_style`: up to 5 items
- `priorities`: up to 5 items
- `constraints`: up to 5 items
- `decisions`: up to 5 items
- `incidents`: up to 3 items
- `recommended_notes`: up to 8 items

## Section Mapping Heuristic

Initial mapping from `memory_type` to packet section:

- `preference` -> `working_style`
- `workflow` -> `working_style`
- `project` -> `active_context`
- `constraint` -> `constraints`
- `decision` -> `decisions`
- `incident` -> `incidents`
- `pattern` -> `recommended_notes`
- `session` -> excluded by default unless packet profile is session-oriented

## Sensitivity Behavior

Before a full policy engine exists, wake-up generation should follow conservative defaults:

- `public`: allowed
- `internal`: allowed
- `confidential`: include only if strongly relevant and avoid verbatim detail by default
- `secret`: excluded from packet body by default

Even when a note is excluded, the packet may record that filtering happened through `policy.suppressed_note_count`.

## Client Shaping

The underlying packet meaning should stay stable, but rendering may vary slightly by target.

### `claude`

Optimize for:

- concise narrative fields
- explicit constraints and working style
- stronger provenance cues

### `codex`

Optimize for:

- file-aware project context
- direct next-note suggestions
- compact action-oriented bullets

### `opencode`

Optimize for:

- neutral machine-readable fields
- predictable section ordering
- low narrative overhead

### `generic`

Return the canonical packet without client-specific wording.

## Output Shapes

The canonical representation should be JSON-first.

Recommended render modes later:

1. `json`: authoritative packet object
2. `markdown`: readable handoff summary
3. `prompt`: compact AI-ready briefing

## Relationship To Retrieval

Wake-up packets do not replace `get` or `explain`.

Instead:

- `wakeup` gives the client a fast, stable orientation bundle
- `get` returns broader context excerpts
- `explain` shows why routing and ranking worked

This means wake-up packet generation should reuse the same routing and candidate scoring core where possible.

## CLI Direction

A future CLI shape should look like:

```bash
spool wakeup \
  --config spool.toml \
  --task "design MCP interface" \
  --cwd /abs/path/to/repo \
  --files src/app.rs \
  --target claude \
  --profile project \
  --format json
```

## Implementation Guidance

The first implementation should:

1. reuse the current route + scan + score pipeline
2. define a packet builder separate from renderers
3. keep packet fields explicit instead of freeform summaries
4. record provenance for every promoted section item
5. keep sensitivity handling centralized rather than scattered across renderers

## Open Questions

1. should `active_context` be a structured object or an ordered list of memory items?
2. should packet shaping happen before or after policy filtering?
3. should `recommended_notes` include only curated notes, or ledger-derived memory objects later?
4. when ledger exists, how should packet generation balance curated truth versus recent raw signals?

## Recommended Next Follow-Up

After this schema is accepted:

1. define `memory_wakeup` in the MCP surface
2. add packet types to the Rust domain model
3. add `wakeup` as a stable CLI subcommand
4. add target-aware packet renderers
5. add policy-aware suppression reporting