wicked-brain 0.5.0 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-brain",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Digital brain as skills for AI coding CLIs — no vector DB, no embeddings, no infrastructure",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-brain-server",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "SQLite FTS5 search server for wicked-brain digital knowledge bases",
6
6
  "keywords": [
@@ -35,10 +35,12 @@ project root.
35
35
 
36
36
  - **mode** (required): `store` or `recall`
37
37
  - **content** (store mode): the memory content to store
38
- - **type** (store mode, optional): `decision`, `pattern`, `preference`, `gotcha`, or `discovery`. Auto-detected if omitted.
38
+ - **type** (store mode, optional): `decision`, `pattern` (alias: `procedural`), `preference`, `gotcha`, or `discovery`. Auto-detected if omitted. `procedural` is an input alias only — storage frontmatter always writes `type: pattern`.
39
39
  - **ttl_days** (store mode, optional): number of days before this memory expires. Defaults by type.
40
+ - **importance** (store mode, optional): `low`, `medium`, or `high`. Overrides the type default. Bands: low = 1-3, medium = 4-6, high = 7-10. Used to derive the initial tier (see Step 2b).
41
+ - **tier** (store mode, optional): explicit tier override (`working`, `episodic`, `semantic`). Takes precedence over `importance`.
40
42
  - **query** (recall mode): search term for finding memories
41
- - **filter_type** (recall mode, optional): filter by memory type
43
+ - **filter_type** (recall mode, optional): filter by memory type. `procedural` is normalized to `pattern`.
42
44
  - **filter_tier** (recall mode, optional): filter by tier (`working`, `episodic`, `semantic`)
43
45
 
44
46
  ## Store Mode
@@ -47,11 +49,15 @@ project root.
47
49
 
48
50
  If type is not provided, classify the content:
49
51
  - Contains "decided", "chose", "will use", "going with" → `decision`
50
- - Contains "pattern", "always", "tends to", "convention" → `pattern`
52
+ - Contains "pattern", "always", "tends to", "convention" → `pattern` (if the caller explicitly passed `type: procedural`, normalize to `pattern` before continuing)
51
53
  - Contains "prefer", "like", "want", "should always" → `preference`
52
54
  - Contains "watch out", "careful", "gotcha", "trap", "bug" → `gotcha`
53
55
  - Otherwise → `discovery`
54
56
 
57
+ #### Type aliases
58
+
59
+ - `procedural` → `pattern` (normalize on input; storage always writes `type: pattern`)
60
+
55
61
  ### Step 2: Apply type defaults
56
62
 
57
63
  | Type | Default importance | Default ttl_days |
@@ -62,7 +68,14 @@ If type is not provided, classify the content:
62
68
  | gotcha | 5 | 30 |
63
69
  | discovery | 4 | 14 |
64
70
 
65
- Agent-provided overrides take precedence.
71
+ Agent-provided overrides take precedence. An explicit `importance` arg overrides the type default.
72
+
73
+ ### Step 2b: Resolve initial tier from importance
74
+
75
+ - If `tier` is explicitly passed → use that, skip the rest.
76
+ - Else if `importance` is `high` (or numeric importance >= 7) → `semantic`
77
+ - Else if `importance` is `low` (or numeric importance <= 3) → `working`
78
+ - Else (medium, or 4-6) → `episodic`
66
79
 
67
80
  ### Step 3: Generate tags with synonym expansion
68
81
 
@@ -88,7 +101,7 @@ Write to `{brain_path}/memory/{safe_name}.md`:
88
101
  ```yaml
89
102
  ---
90
103
  type: {detected or provided type}
91
- tier: working
104
+ tier: {resolved tier from Step 2b}
92
105
  confidence: 0.5
93
106
  importance: {from type defaults or override}
94
107
  ttl_days: {from type defaults or override, null if permanent}
@@ -112,14 +125,14 @@ indexed_at: "{ISO 8601 timestamp}"
112
125
  - **episodic**: Specific events or decisions from past sessions. Medium longevity. Use for "we decided X on date Y" or "this happened in project Z".
113
126
  - **semantic**: Generalized patterns and facts extracted from experience. Permanent by default. Use for stable conventions, recurring patterns, and distilled knowledge that transcends any single session.
114
127
 
115
- New memories always start at `tier: working`. Consolidation (wicked-brain:consolidate) promotes them to `episodic` or `semantic` based on access frequency and age.
128
+ New memories start at the tier resolved from importance (default `episodic` for medium importance, `working` for low, `semantic` for high). Consolidation (wicked-brain:consolidate) still promotes them across tiers based on access frequency and age.
116
129
 
117
130
  #### Complete example
118
131
 
119
132
  ```yaml
120
133
  ---
121
134
  type: decision
122
- tier: working
135
+ tier: semantic
123
136
  confidence: 0.9
124
137
  importance: 7
125
138
  ttl_days: null
@@ -151,7 +164,7 @@ The server's file watcher will auto-index this file.
151
164
  Append to `{brain_path}/_meta/log.jsonl`:
152
165
 
153
166
  ```json
154
- {"ts":"{ISO}","op":"memory_store","path":"memory/{safe_name}.md","type":"{type}","tier":"working","author":"agent:memory"}
167
+ {"ts":"{ISO}","op":"memory_store","path":"memory/{safe_name}.md","type":"{type}","tier":"{resolved tier}","author":"agent:memory"}
155
168
  ```
156
169
 
157
170
  ### Step 7: Emit bus event
@@ -161,7 +174,7 @@ npx wicked-bus emit \
161
174
  --type "wicked.memory.stored" \
162
175
  --domain "wicked-brain" \
163
176
  --subdomain "brain.memory" \
164
- --payload '{"path":"memory/{safe_name}.md","type":"{type}","tier":"working","brain_id":"{brain_id}"}' 2>/dev/null || true
177
+ --payload '{"path":"memory/{safe_name}.md","type":"{type}","tier":"{resolved tier}","brain_id":"{brain_id}"}' 2>/dev/null || true
165
178
  ```
166
179
 
167
180
  Fire-and-forget — if the bus is not installed, silently skip.
@@ -187,7 +200,7 @@ consolidation. Use a consistent session_id for the entire conversation.
187
200
 
188
201
  ### Step 2: Filter results
189
202
 
190
- Filter to paths starting with `memory/`. If filter_type or filter_tier provided, read frontmatter and filter accordingly.
203
+ Filter to paths starting with `memory/`. If filter_type or filter_tier provided, read frontmatter and filter accordingly. Normalize `filter_type: procedural` to `pattern` before matching, so it matches memories stored with `type: pattern`.
191
204
 
192
205
  ### Step 3: Apply tier weighting
193
206