@cleocode/cleo 2026.4.66 → 2026.4.68
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/dist/cli/index.js +640 -221
- package/dist/cli/index.js.map +4 -4
- package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/migration.sql +12 -0
- package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/snapshot.json +1232 -0
- package/migrations/drizzle-brain/20260408000001_t417-agent-field/migration.sql +13 -0
- package/migrations/drizzle-brain/20260408000001_t417-agent-field/snapshot.json +28 -0
- package/migrations/drizzle-brain/20260411000001_t528-graph-schema-expansion/migration.sql +47 -0
- package/migrations/drizzle-brain/20260412000001_t531-quality-score-typed-tables/migration.sql +23 -0
- package/migrations/drizzle-brain/20260413000001_t549-tiered-typed-memory/migration.sql +195 -0
- package/migrations/drizzle-brain/20260415000001_t626-normalize-co-retrieved-edge-type/migration.sql +14 -0
- package/migrations/drizzle-brain/20260416000001_t673-retrieval-log-plasticity-columns/migration.sql +57 -0
- package/migrations/drizzle-brain/20260416000002_t673-plasticity-events-expand/migration.sql +44 -0
- package/migrations/drizzle-brain/20260416000003_t673-page-edges-plasticity-columns/migration.sql +44 -0
- package/migrations/drizzle-brain/20260416000004_t673-new-plasticity-tables/migration.sql +73 -0
- package/migrations/drizzle-brain/20260416000005_t726-dedup-tier-columns/migration.sql +77 -0
- package/migrations/drizzle-nexus/20260412000001_t529-nexus-graph-tables/migration.sql +49 -0
- package/migrations/drizzle-nexus/20260415000001_t622-project-registry-paths/migration.sql +12 -0
- package/migrations/drizzle-tasks/20260320013731_wave0-schema-hardening/migration.sql +84 -0
- package/migrations/drizzle-tasks/20260320013731_wave0-schema-hardening/snapshot.json +4060 -0
- package/migrations/drizzle-tasks/20260320020000_agent-dimension/migration.sql +35 -0
- package/migrations/drizzle-tasks/20260320020000_agent-dimension/snapshot.json +4312 -0
- package/migrations/drizzle-tasks/20260321000000_t033-connection-health/migration.sql +518 -0
- package/migrations/drizzle-tasks/20260321000000_t033-connection-health/snapshot.json +4312 -0
- package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/migration.sql +82 -0
- package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/snapshot.json +9 -0
- package/migrations/drizzle-tasks/20260324000000_assignee-column/migration.sql +6 -0
- package/migrations/drizzle-tasks/20260324000000_assignee-column/snapshot.json +9 -0
- package/migrations/drizzle-tasks/20260327000000_agent-credentials/migration.sql +23 -0
- package/package.json +8 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- T417: Wave 8 Mental Models — add `agent` provenance field to brain_observations.
|
|
2
|
+
-- Identifies the spawned agent that produced an observation for per-agent mental
|
|
3
|
+
-- model retrieval via `memory.find --agent <name>`.
|
|
4
|
+
--
|
|
5
|
+
-- Idempotent: SQLite does not support ADD COLUMN IF NOT EXISTS in all versions,
|
|
6
|
+
-- so we use a best-effort pattern with a guard query; the migrator journal
|
|
7
|
+
-- prevents double-execution, making idempotency via the journal sufficient.
|
|
8
|
+
|
|
9
|
+
ALTER TABLE `brain_observations` ADD COLUMN `agent` text;
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
|
|
12
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_agent`
|
|
13
|
+
ON `brain_observations` (`agent`);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "t417-agent-field-20260408",
|
|
5
|
+
"prevIds": [
|
|
6
|
+
"t033-brain-indexes-20260321"
|
|
7
|
+
],
|
|
8
|
+
"tables": {
|
|
9
|
+
"brain_observations": {
|
|
10
|
+
"name": "brain_observations",
|
|
11
|
+
"columns": {
|
|
12
|
+
"agent": {
|
|
13
|
+
"name": "agent",
|
|
14
|
+
"type": "text",
|
|
15
|
+
"primaryKey": false,
|
|
16
|
+
"notNull": false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"indexes": {
|
|
20
|
+
"idx_brain_observations_agent": {
|
|
21
|
+
"name": "idx_brain_observations_agent",
|
|
22
|
+
"columns": ["agent"],
|
|
23
|
+
"isUnique": false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- T528: Graph-native memory model — expand brain_page_nodes and brain_page_edges schemas.
|
|
2
|
+
-- Adds quality scoring, content hashing, last-activity tracking, provenance, and new
|
|
3
|
+
-- indexes to support traversable knowledge graph operations.
|
|
4
|
+
--
|
|
5
|
+
-- Additive only: all new columns have defaults so existing rows are unaffected.
|
|
6
|
+
-- brain_page_nodes has 0 rows and brain_page_edges has 0 rows (confirmed by R1 audit),
|
|
7
|
+
-- so no data migration is required.
|
|
8
|
+
|
|
9
|
+
ALTER TABLE `brain_page_nodes` ADD COLUMN `quality_score` real NOT NULL DEFAULT 0.5;
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
ALTER TABLE `brain_page_nodes` ADD COLUMN `content_hash` text;
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
ALTER TABLE `brain_page_nodes` ADD COLUMN `last_activity_at` text NOT NULL DEFAULT (datetime('now'));
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
ALTER TABLE `brain_page_nodes` ADD COLUMN `updated_at` text;
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `provenance` text;
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
|
|
20
|
+
-- brain_page_edges.weight was nullable (DEFAULT 1) in the initial schema;
|
|
21
|
+
-- changing NOT NULL constraint requires recreating the table in SQLite.
|
|
22
|
+
-- Since brain_page_edges has 0 rows, we drop and recreate.
|
|
23
|
+
DROP TABLE IF EXISTS `brain_page_edges`;
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE TABLE `brain_page_edges` (
|
|
26
|
+
`from_id` text NOT NULL,
|
|
27
|
+
`to_id` text NOT NULL,
|
|
28
|
+
`edge_type` text NOT NULL,
|
|
29
|
+
`weight` real NOT NULL DEFAULT 1,
|
|
30
|
+
`provenance` text,
|
|
31
|
+
`created_at` text NOT NULL DEFAULT (datetime('now')),
|
|
32
|
+
CONSTRAINT `brain_page_edges_pk` PRIMARY KEY(`from_id`, `to_id`, `edge_type`)
|
|
33
|
+
);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
|
|
36
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_nodes_quality` ON `brain_page_nodes` (`quality_score`);
|
|
37
|
+
--> statement-breakpoint
|
|
38
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_nodes_content_hash` ON `brain_page_nodes` (`content_hash`);
|
|
39
|
+
--> statement-breakpoint
|
|
40
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_nodes_last_activity` ON `brain_page_nodes` (`last_activity_at`);
|
|
41
|
+
--> statement-breakpoint
|
|
42
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_edges_type` ON `brain_page_edges` (`edge_type`);
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
-- Re-create existing edge indexes (dropped with table)
|
|
45
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_edges_from` ON `brain_page_edges` (`from_id`);
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_edges_to` ON `brain_page_edges` (`to_id`);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- T531: Wire quality scoring into brain memory store functions.
|
|
2
|
+
-- Adds quality_score column to the four typed brain tables.
|
|
3
|
+
-- NULL is used for legacy rows (not yet scored); new rows get a computed score.
|
|
4
|
+
-- Search filtering uses "IS NULL OR quality_score >= 0.3" so legacy entries are retained.
|
|
5
|
+
--
|
|
6
|
+
-- Additive only: all columns are nullable so existing rows are unaffected.
|
|
7
|
+
|
|
8
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `quality_score` real;
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `quality_score` real;
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `quality_score` real;
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
ALTER TABLE `brain_observations` ADD COLUMN `quality_score` real;
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
|
|
17
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_quality` ON `brain_decisions` (`quality_score`);
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_quality` ON `brain_patterns` (`quality_score`);
|
|
20
|
+
--> statement-breakpoint
|
|
21
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_quality` ON `brain_learnings` (`quality_score`);
|
|
22
|
+
--> statement-breakpoint
|
|
23
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_quality` ON `brain_observations` (`quality_score`);
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
-- T549: Tiered + Typed Memory Architecture v2
|
|
2
|
+
-- Adds: memory_tier, memory_type (cognitive), verified, valid_at, invalid_at,
|
|
3
|
+
-- source_confidence, citation_count to all four typed brain tables.
|
|
4
|
+
--
|
|
5
|
+
-- Strategy: all columns are nullable or have defaults; no existing rows are broken.
|
|
6
|
+
-- NULL-handling contracts: legacy rows are backfilled at the end of this migration.
|
|
7
|
+
-- memory_tier NULL → treated as 'medium' at query time (survived T523 purge).
|
|
8
|
+
-- memory_type NULL → treated as table default at query time.
|
|
9
|
+
-- CONFLICT-03 resolution: citation_count added per cross-validation report (T549-XV).
|
|
10
|
+
-- CONFLICT-01 resolution: cognitive type enum is BRAIN_COGNITIVE_TYPES (semantic/episodic/procedural).
|
|
11
|
+
-- T553 fix: valid_at columns use nullable DEFAULT (datetime('now')) instead of NOT NULL DEFAULT
|
|
12
|
+
-- because SQLite forbids ALTER TABLE ADD COLUMN with a non-constant default on non-empty tables.
|
|
13
|
+
-- The backfill UPDATEs at the end of this migration set valid_at = created_at for all existing
|
|
14
|
+
-- rows, so no row ever has a NULL valid_at after migration completes.
|
|
15
|
+
|
|
16
|
+
-- ============================================================
|
|
17
|
+
-- brain_decisions
|
|
18
|
+
-- ============================================================
|
|
19
|
+
|
|
20
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `memory_tier` text DEFAULT 'short';
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `memory_type` text DEFAULT 'semantic';
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `verified` integer NOT NULL DEFAULT 0;
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `valid_at` text DEFAULT (datetime('now'));
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `invalid_at` text;
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `source_confidence` text DEFAULT 'agent';
|
|
31
|
+
--> statement-breakpoint
|
|
32
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `citation_count` integer NOT NULL DEFAULT 0;
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
|
|
35
|
+
-- ============================================================
|
|
36
|
+
-- brain_patterns
|
|
37
|
+
-- ============================================================
|
|
38
|
+
|
|
39
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `memory_tier` text DEFAULT 'short';
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `memory_type` text DEFAULT 'procedural';
|
|
42
|
+
--> statement-breakpoint
|
|
43
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `verified` integer NOT NULL DEFAULT 0;
|
|
44
|
+
--> statement-breakpoint
|
|
45
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `valid_at` text DEFAULT (datetime('now'));
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `invalid_at` text;
|
|
48
|
+
--> statement-breakpoint
|
|
49
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `source_confidence` text DEFAULT 'agent';
|
|
50
|
+
--> statement-breakpoint
|
|
51
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `citation_count` integer NOT NULL DEFAULT 0;
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
|
|
54
|
+
-- ============================================================
|
|
55
|
+
-- brain_learnings
|
|
56
|
+
-- ============================================================
|
|
57
|
+
|
|
58
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `memory_tier` text DEFAULT 'short';
|
|
59
|
+
--> statement-breakpoint
|
|
60
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `memory_type` text DEFAULT 'semantic';
|
|
61
|
+
--> statement-breakpoint
|
|
62
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `verified` integer NOT NULL DEFAULT 0;
|
|
63
|
+
--> statement-breakpoint
|
|
64
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `valid_at` text DEFAULT (datetime('now'));
|
|
65
|
+
--> statement-breakpoint
|
|
66
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `invalid_at` text;
|
|
67
|
+
--> statement-breakpoint
|
|
68
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `source_confidence` text DEFAULT 'agent';
|
|
69
|
+
--> statement-breakpoint
|
|
70
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `citation_count` integer NOT NULL DEFAULT 0;
|
|
71
|
+
--> statement-breakpoint
|
|
72
|
+
|
|
73
|
+
-- ============================================================
|
|
74
|
+
-- brain_observations
|
|
75
|
+
-- ============================================================
|
|
76
|
+
|
|
77
|
+
ALTER TABLE `brain_observations` ADD COLUMN `memory_tier` text DEFAULT 'short';
|
|
78
|
+
--> statement-breakpoint
|
|
79
|
+
ALTER TABLE `brain_observations` ADD COLUMN `memory_type` text DEFAULT 'episodic';
|
|
80
|
+
--> statement-breakpoint
|
|
81
|
+
ALTER TABLE `brain_observations` ADD COLUMN `verified` integer NOT NULL DEFAULT 0;
|
|
82
|
+
--> statement-breakpoint
|
|
83
|
+
ALTER TABLE `brain_observations` ADD COLUMN `valid_at` text DEFAULT (datetime('now'));
|
|
84
|
+
--> statement-breakpoint
|
|
85
|
+
ALTER TABLE `brain_observations` ADD COLUMN `invalid_at` text;
|
|
86
|
+
--> statement-breakpoint
|
|
87
|
+
ALTER TABLE `brain_observations` ADD COLUMN `source_confidence` text DEFAULT 'agent';
|
|
88
|
+
--> statement-breakpoint
|
|
89
|
+
ALTER TABLE `brain_observations` ADD COLUMN `citation_count` integer NOT NULL DEFAULT 0;
|
|
90
|
+
--> statement-breakpoint
|
|
91
|
+
|
|
92
|
+
-- ============================================================
|
|
93
|
+
-- Indexes for new columns (query hot paths)
|
|
94
|
+
-- ============================================================
|
|
95
|
+
|
|
96
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_tier` ON `brain_decisions` (`memory_tier`);
|
|
97
|
+
--> statement-breakpoint
|
|
98
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_type` ON `brain_decisions` (`memory_type`);
|
|
99
|
+
--> statement-breakpoint
|
|
100
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_verified` ON `brain_decisions` (`verified`);
|
|
101
|
+
--> statement-breakpoint
|
|
102
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_valid_at` ON `brain_decisions` (`valid_at`);
|
|
103
|
+
--> statement-breakpoint
|
|
104
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_source_conf` ON `brain_decisions` (`source_confidence`);
|
|
105
|
+
--> statement-breakpoint
|
|
106
|
+
|
|
107
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_tier` ON `brain_patterns` (`memory_tier`);
|
|
108
|
+
--> statement-breakpoint
|
|
109
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_type` ON `brain_patterns` (`memory_type`);
|
|
110
|
+
--> statement-breakpoint
|
|
111
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_verified` ON `brain_patterns` (`verified`);
|
|
112
|
+
--> statement-breakpoint
|
|
113
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_valid_at` ON `brain_patterns` (`valid_at`);
|
|
114
|
+
--> statement-breakpoint
|
|
115
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_source_conf` ON `brain_patterns` (`source_confidence`);
|
|
116
|
+
--> statement-breakpoint
|
|
117
|
+
|
|
118
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_tier` ON `brain_learnings` (`memory_tier`);
|
|
119
|
+
--> statement-breakpoint
|
|
120
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_type` ON `brain_learnings` (`memory_type`);
|
|
121
|
+
--> statement-breakpoint
|
|
122
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_verified` ON `brain_learnings` (`verified`);
|
|
123
|
+
--> statement-breakpoint
|
|
124
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_valid_at` ON `brain_learnings` (`valid_at`);
|
|
125
|
+
--> statement-breakpoint
|
|
126
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_invalid` ON `brain_learnings` (`invalid_at`);
|
|
127
|
+
--> statement-breakpoint
|
|
128
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_source_conf` ON `brain_learnings` (`source_confidence`);
|
|
129
|
+
--> statement-breakpoint
|
|
130
|
+
|
|
131
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_tier` ON `brain_observations` (`memory_tier`);
|
|
132
|
+
--> statement-breakpoint
|
|
133
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_type` ON `brain_observations` (`memory_type`);
|
|
134
|
+
--> statement-breakpoint
|
|
135
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_verified` ON `brain_observations` (`verified`);
|
|
136
|
+
--> statement-breakpoint
|
|
137
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_valid_at` ON `brain_observations` (`valid_at`);
|
|
138
|
+
--> statement-breakpoint
|
|
139
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_invalid` ON `brain_observations` (`invalid_at`);
|
|
140
|
+
--> statement-breakpoint
|
|
141
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_source_conf` ON `brain_observations` (`source_confidence`);
|
|
142
|
+
--> statement-breakpoint
|
|
143
|
+
|
|
144
|
+
-- ============================================================
|
|
145
|
+
-- Backfill: legacy rows (survivors of the T523 purge)
|
|
146
|
+
-- Treat existing rows as medium-to-long-term based on quality signals.
|
|
147
|
+
-- valid_at defaults to created_at so bitemporal queries work correctly.
|
|
148
|
+
-- ============================================================
|
|
149
|
+
|
|
150
|
+
UPDATE `brain_decisions` SET
|
|
151
|
+
memory_tier = CASE
|
|
152
|
+
WHEN confidence = 'high' THEN 'long'
|
|
153
|
+
WHEN confidence = 'medium' THEN 'medium'
|
|
154
|
+
ELSE 'medium'
|
|
155
|
+
END,
|
|
156
|
+
memory_type = 'semantic',
|
|
157
|
+
valid_at = created_at,
|
|
158
|
+
source_confidence = 'agent'
|
|
159
|
+
WHERE memory_tier IS NULL;
|
|
160
|
+
--> statement-breakpoint
|
|
161
|
+
|
|
162
|
+
UPDATE `brain_patterns` SET
|
|
163
|
+
memory_tier = CASE
|
|
164
|
+
WHEN frequency >= 5 THEN 'long'
|
|
165
|
+
WHEN frequency >= 2 THEN 'medium'
|
|
166
|
+
ELSE 'medium'
|
|
167
|
+
END,
|
|
168
|
+
memory_type = 'procedural',
|
|
169
|
+
valid_at = extracted_at,
|
|
170
|
+
source_confidence = 'agent'
|
|
171
|
+
WHERE memory_tier IS NULL;
|
|
172
|
+
--> statement-breakpoint
|
|
173
|
+
|
|
174
|
+
UPDATE `brain_learnings` SET
|
|
175
|
+
memory_tier = CASE
|
|
176
|
+
WHEN confidence >= 0.80 THEN 'long'
|
|
177
|
+
WHEN confidence >= 0.60 THEN 'medium'
|
|
178
|
+
ELSE 'medium'
|
|
179
|
+
END,
|
|
180
|
+
memory_type = 'semantic',
|
|
181
|
+
valid_at = created_at,
|
|
182
|
+
source_confidence = 'agent'
|
|
183
|
+
WHERE memory_tier IS NULL;
|
|
184
|
+
--> statement-breakpoint
|
|
185
|
+
|
|
186
|
+
UPDATE `brain_observations` SET
|
|
187
|
+
memory_tier = 'medium',
|
|
188
|
+
memory_type = 'episodic',
|
|
189
|
+
valid_at = created_at,
|
|
190
|
+
source_confidence = CASE
|
|
191
|
+
WHEN source_type = 'manual' THEN 'owner'
|
|
192
|
+
WHEN source_type = 'session-debrief' THEN 'task-outcome'
|
|
193
|
+
ELSE 'agent'
|
|
194
|
+
END
|
|
195
|
+
WHERE memory_tier IS NULL;
|
package/migrations/drizzle-brain/20260415000001_t626-normalize-co-retrieved-edge-type/migration.sql
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- T626-M1: Normalize co_retrieved edge type
|
|
2
|
+
--
|
|
3
|
+
-- The shipped Hebbian strengthener (brain-lifecycle.ts:strengthenCoRetrievedEdges)
|
|
4
|
+
-- was emitting edge_type = 'relates_to' instead of 'co_retrieved'. This migration
|
|
5
|
+
-- relabels all existing rows that were created by that code path.
|
|
6
|
+
--
|
|
7
|
+
-- Safety: the WHERE clause constrains to rows whose provenance starts with
|
|
8
|
+
-- 'consolidation:' so only Hebbian edges are touched; no semantic edges are
|
|
9
|
+
-- affected. co_retrieved is already in BRAIN_EDGE_TYPES so Drizzle accepts it.
|
|
10
|
+
|
|
11
|
+
UPDATE `brain_page_edges`
|
|
12
|
+
SET edge_type = 'co_retrieved'
|
|
13
|
+
WHERE edge_type = 'relates_to'
|
|
14
|
+
AND provenance LIKE 'consolidation:%';
|
package/migrations/drizzle-brain/20260416000001_t673-retrieval-log-plasticity-columns/migration.sql
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
-- T673-M1: Plasticity columns for brain_retrieval_log
|
|
2
|
+
--
|
|
3
|
+
-- Adds two NEW columns to the live table:
|
|
4
|
+
-- session_id — declared in Drizzle at brain-schema.ts but never applied to
|
|
5
|
+
-- the live table via ALTER TABLE (was missing from live DDL)
|
|
6
|
+
-- reward_signal — R-STDP third-factor scalar [-1.0, +1.0] (D-BRAIN-VIZ-13)
|
|
7
|
+
--
|
|
8
|
+
-- NOTE: retrieval_order and delta_ms are NOT added here — they already exist in
|
|
9
|
+
-- the live table via the self-healing DDL in brain-sqlite.ts (logRetrieval
|
|
10
|
+
-- CREATE TABLE IF NOT EXISTS). The Drizzle schema declaration in brain-schema.ts
|
|
11
|
+
-- now includes them for type-safety only (schema drift sync, no migration needed).
|
|
12
|
+
--
|
|
13
|
+
-- SAFETY: brain_retrieval_log may not exist on a fresh DB (it was created only
|
|
14
|
+
-- via self-healing DDL). CREATE TABLE IF NOT EXISTS ensures it exists so the
|
|
15
|
+
-- ALTER TABLE statements can succeed on fresh installs.
|
|
16
|
+
--
|
|
17
|
+
-- All UPDATE statements are idempotent via their WHERE clauses.
|
|
18
|
+
-- Migration sequence: M1 must precede M2/M3/M4.
|
|
19
|
+
-- Spec ref: docs/specs/stdp-wire-up-spec.md §5.1
|
|
20
|
+
|
|
21
|
+
CREATE TABLE IF NOT EXISTS `brain_retrieval_log` (
|
|
22
|
+
`id` integer PRIMARY KEY AUTOINCREMENT,
|
|
23
|
+
`query` text NOT NULL,
|
|
24
|
+
`entry_ids` text NOT NULL,
|
|
25
|
+
`entry_count` integer NOT NULL,
|
|
26
|
+
`source` text NOT NULL,
|
|
27
|
+
`tokens_used` integer,
|
|
28
|
+
`created_at` text NOT NULL DEFAULT (datetime('now'))
|
|
29
|
+
);
|
|
30
|
+
--> statement-breakpoint
|
|
31
|
+
|
|
32
|
+
ALTER TABLE `brain_retrieval_log` ADD COLUMN `session_id` text;
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
ALTER TABLE `brain_retrieval_log` ADD COLUMN `reward_signal` real;
|
|
35
|
+
--> statement-breakpoint
|
|
36
|
+
|
|
37
|
+
-- Convert comma-separated entry_ids to JSON array format (idempotent).
|
|
38
|
+
-- Rows already in JSON format (starting with '[') are untouched.
|
|
39
|
+
-- Fixes BUG-2: readers call JSON.parse() but writer stored CSV.
|
|
40
|
+
-- Per spec §2.3.
|
|
41
|
+
UPDATE `brain_retrieval_log`
|
|
42
|
+
SET entry_ids = '["' || REPLACE(entry_ids, ',', '","') || '"]'
|
|
43
|
+
WHERE entry_ids IS NOT NULL AND entry_ids != '' AND entry_ids NOT LIKE '[%';
|
|
44
|
+
--> statement-breakpoint
|
|
45
|
+
|
|
46
|
+
-- Backfill synthetic session IDs for historical rows (spec §2.4 / T715).
|
|
47
|
+
-- One ses_backfill_YYYY-MM-DD per calendar day in created_at.
|
|
48
|
+
-- Rows already having a session_id are untouched (idempotent).
|
|
49
|
+
-- backfillRewardSignals MUST skip rows where session_id LIKE 'ses_backfill_%'.
|
|
50
|
+
UPDATE `brain_retrieval_log`
|
|
51
|
+
SET session_id = 'ses_backfill_' || substr(created_at, 1, 10)
|
|
52
|
+
WHERE session_id IS NULL;
|
|
53
|
+
--> statement-breakpoint
|
|
54
|
+
|
|
55
|
+
CREATE INDEX IF NOT EXISTS `idx_retrieval_log_reward` ON `brain_retrieval_log` (`reward_signal`);
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
CREATE INDEX IF NOT EXISTS `idx_retrieval_log_session` ON `brain_retrieval_log` (`session_id`);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- T673-M2: Expand brain_plasticity_events with observability columns.
|
|
2
|
+
--
|
|
3
|
+
-- Adds 5 new nullable columns to brain_plasticity_events:
|
|
4
|
+
-- weight_before — edge weight immediately before this event
|
|
5
|
+
-- weight_after — edge weight immediately after this event
|
|
6
|
+
-- retrieval_log_id — soft FK to brain_retrieval_log.id (causal trace)
|
|
7
|
+
-- reward_signal — R-STDP reward signal at time of event
|
|
8
|
+
-- delta_t_ms — Δt in ms between the two spikes that generated this event
|
|
9
|
+
--
|
|
10
|
+
-- Safety: table currently has 0 rows so all new nullable columns have no data impact.
|
|
11
|
+
-- New INSERT statements in brain-stdp.ts MUST populate these columns going forward.
|
|
12
|
+
--
|
|
13
|
+
-- SAFETY: brain_plasticity_events is not in the initial migration — it was created
|
|
14
|
+
-- only via self-healing DDL in brain-sqlite.ts. On a fresh DB this migration
|
|
15
|
+
-- runs before the self-healing code. CREATE TABLE IF NOT EXISTS ensures the
|
|
16
|
+
-- table exists so the ALTER TABLE statements below can succeed.
|
|
17
|
+
--
|
|
18
|
+
-- Per docs/specs/stdp-wire-up-spec.md §2.1.2 and T673-council-schema.md §4.2.
|
|
19
|
+
|
|
20
|
+
CREATE TABLE IF NOT EXISTS `brain_plasticity_events` (
|
|
21
|
+
`id` integer PRIMARY KEY AUTOINCREMENT,
|
|
22
|
+
`source_node` text NOT NULL,
|
|
23
|
+
`target_node` text NOT NULL,
|
|
24
|
+
`delta_w` real NOT NULL,
|
|
25
|
+
`kind` text NOT NULL,
|
|
26
|
+
`timestamp` text NOT NULL DEFAULT (datetime('now')),
|
|
27
|
+
`session_id` text
|
|
28
|
+
);
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
|
|
31
|
+
ALTER TABLE `brain_plasticity_events` ADD COLUMN `weight_before` real;
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
ALTER TABLE `brain_plasticity_events` ADD COLUMN `weight_after` real;
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
ALTER TABLE `brain_plasticity_events` ADD COLUMN `retrieval_log_id` integer;
|
|
36
|
+
--> statement-breakpoint
|
|
37
|
+
ALTER TABLE `brain_plasticity_events` ADD COLUMN `reward_signal` real;
|
|
38
|
+
--> statement-breakpoint
|
|
39
|
+
ALTER TABLE `brain_plasticity_events` ADD COLUMN `delta_t_ms` integer;
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
|
|
42
|
+
CREATE INDEX IF NOT EXISTS `idx_plasticity_retrieval_log` ON `brain_plasticity_events` (`retrieval_log_id`);
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
CREATE INDEX IF NOT EXISTS `idx_plasticity_reward` ON `brain_plasticity_events` (`reward_signal`);
|
package/migrations/drizzle-brain/20260416000003_t673-page-edges-plasticity-columns/migration.sql
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- T673-M3: Add plasticity tracking columns to brain_page_edges.
|
|
2
|
+
--
|
|
3
|
+
-- Adds 6 new columns enabling the STDP plasticity substrate:
|
|
4
|
+
-- last_reinforced_at — ISO 8601 timestamp of last LTP event
|
|
5
|
+
-- reinforcement_count — count of LTP events applied lifetime (DEFAULT 0)
|
|
6
|
+
-- plasticity_class — routing class: 'static' | 'hebbian' | 'stdp' (DEFAULT 'static')
|
|
7
|
+
-- last_depressed_at — ISO 8601 timestamp of last LTD event
|
|
8
|
+
-- depression_count — count of LTD events applied lifetime (DEFAULT 0)
|
|
9
|
+
-- stability_score — tanh(rc/10) * exp(-(days/30)), null = not yet computed
|
|
10
|
+
--
|
|
11
|
+
-- Seeding strategy:
|
|
12
|
+
-- - All existing edges: plasticity_class = 'static' (safe default via ALTER TABLE)
|
|
13
|
+
-- - co_retrieved edges are overridden to 'hebbian' (Hebbian strengthener origin)
|
|
14
|
+
--
|
|
15
|
+
-- New indexes:
|
|
16
|
+
-- idx_brain_edges_last_reinforced — decay pass filter (skip recently reinforced)
|
|
17
|
+
-- idx_brain_edges_plasticity_class — class routing (skip static edges in decay)
|
|
18
|
+
-- idx_brain_edges_stability — fast stable-edge skip filter
|
|
19
|
+
--
|
|
20
|
+
-- Per docs/specs/stdp-wire-up-spec.md §2.1.3 and T673-council-schema.md §4.3.
|
|
21
|
+
|
|
22
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `last_reinforced_at` text;
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `reinforcement_count` integer NOT NULL DEFAULT 0;
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `plasticity_class` text NOT NULL DEFAULT 'static';
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `last_depressed_at` text;
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `depression_count` integer NOT NULL DEFAULT 0;
|
|
31
|
+
--> statement-breakpoint
|
|
32
|
+
ALTER TABLE `brain_page_edges` ADD COLUMN `stability_score` real;
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
|
|
35
|
+
-- Seed: co_retrieved edges are Hebbian-origin, not static.
|
|
36
|
+
-- This UPDATE is idempotent — re-running sets already-hebbian rows to hebbian.
|
|
37
|
+
UPDATE `brain_page_edges` SET plasticity_class = 'hebbian' WHERE edge_type = 'co_retrieved';
|
|
38
|
+
--> statement-breakpoint
|
|
39
|
+
|
|
40
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_edges_last_reinforced` ON `brain_page_edges` (`last_reinforced_at`);
|
|
41
|
+
--> statement-breakpoint
|
|
42
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_edges_plasticity_class` ON `brain_page_edges` (`plasticity_class`);
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_edges_stability` ON `brain_page_edges` (`stability_score`);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
-- T673-M4: New plasticity infrastructure tables
|
|
2
|
+
-- brain_weight_history: per-edge delta-w audit log (owner Q4 mandate -- 90-day rolling retention)
|
|
3
|
+
-- brain_modulators: R-STDP reward/correction/user_feedback event log
|
|
4
|
+
-- brain_consolidation_events: pipeline run audit for T628 auto-dream + manual consolidations
|
|
5
|
+
-- All IF NOT EXISTS -- safe to apply multiple times (idempotent).
|
|
6
|
+
-- Retention: brain_weight_history rows older than 90 days are swept by runConsolidation Step 9d.
|
|
7
|
+
-- Actual pruning wired in Wave 3 (T690 homeostatic decay per spec §4.2 Step 9d).
|
|
8
|
+
|
|
9
|
+
CREATE TABLE IF NOT EXISTS `brain_weight_history` (
|
|
10
|
+
`id` integer PRIMARY KEY AUTOINCREMENT,
|
|
11
|
+
`edge_from_id` text NOT NULL,
|
|
12
|
+
`edge_to_id` text NOT NULL,
|
|
13
|
+
`edge_type` text NOT NULL,
|
|
14
|
+
`weight_before` real,
|
|
15
|
+
`weight_after` real NOT NULL,
|
|
16
|
+
`delta_weight` real NOT NULL,
|
|
17
|
+
`event_kind` text NOT NULL,
|
|
18
|
+
`source_plasticity_event_id` integer,
|
|
19
|
+
`retrieval_log_id` integer,
|
|
20
|
+
`reward_signal` real,
|
|
21
|
+
`changed_at` text NOT NULL DEFAULT (datetime('now'))
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
CREATE INDEX IF NOT EXISTS `idx_weight_history_edge` ON `brain_weight_history` (`edge_from_id`, `edge_to_id`, `edge_type`);
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
CREATE INDEX IF NOT EXISTS `idx_weight_history_from` ON `brain_weight_history` (`edge_from_id`);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
CREATE INDEX IF NOT EXISTS `idx_weight_history_to` ON `brain_weight_history` (`edge_to_id`);
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
CREATE INDEX IF NOT EXISTS `idx_weight_history_changed_at` ON `brain_weight_history` (`changed_at`);
|
|
31
|
+
--> statement-breakpoint
|
|
32
|
+
CREATE INDEX IF NOT EXISTS `idx_weight_history_event_kind` ON `brain_weight_history` (`event_kind`);
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
CREATE INDEX IF NOT EXISTS `idx_weight_history_plasticity_event` ON `brain_weight_history` (`source_plasticity_event_id`);
|
|
35
|
+
--> statement-breakpoint
|
|
36
|
+
|
|
37
|
+
CREATE TABLE IF NOT EXISTS `brain_modulators` (
|
|
38
|
+
`id` integer PRIMARY KEY AUTOINCREMENT,
|
|
39
|
+
`modulator_type` text NOT NULL,
|
|
40
|
+
`valence` real NOT NULL,
|
|
41
|
+
`magnitude` real NOT NULL DEFAULT 1.0,
|
|
42
|
+
`source_event_id` text,
|
|
43
|
+
`session_id` text,
|
|
44
|
+
`description` text,
|
|
45
|
+
`created_at` text NOT NULL DEFAULT (datetime('now'))
|
|
46
|
+
);
|
|
47
|
+
--> statement-breakpoint
|
|
48
|
+
CREATE INDEX IF NOT EXISTS `idx_modulators_type` ON `brain_modulators` (`modulator_type`);
|
|
49
|
+
--> statement-breakpoint
|
|
50
|
+
CREATE INDEX IF NOT EXISTS `idx_modulators_session` ON `brain_modulators` (`session_id`);
|
|
51
|
+
--> statement-breakpoint
|
|
52
|
+
CREATE INDEX IF NOT EXISTS `idx_modulators_created_at` ON `brain_modulators` (`created_at`);
|
|
53
|
+
--> statement-breakpoint
|
|
54
|
+
CREATE INDEX IF NOT EXISTS `idx_modulators_source_event` ON `brain_modulators` (`source_event_id`);
|
|
55
|
+
--> statement-breakpoint
|
|
56
|
+
CREATE INDEX IF NOT EXISTS `idx_modulators_valence` ON `brain_modulators` (`valence`);
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
|
|
59
|
+
CREATE TABLE IF NOT EXISTS `brain_consolidation_events` (
|
|
60
|
+
`id` integer PRIMARY KEY AUTOINCREMENT,
|
|
61
|
+
`trigger` text NOT NULL,
|
|
62
|
+
`session_id` text,
|
|
63
|
+
`step_results_json` text NOT NULL,
|
|
64
|
+
`duration_ms` integer,
|
|
65
|
+
`succeeded` integer NOT NULL DEFAULT 1,
|
|
66
|
+
`started_at` text NOT NULL DEFAULT (datetime('now'))
|
|
67
|
+
);
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
CREATE INDEX IF NOT EXISTS `idx_consolidation_events_started_at` ON `brain_consolidation_events` (`started_at`);
|
|
70
|
+
--> statement-breakpoint
|
|
71
|
+
CREATE INDEX IF NOT EXISTS `idx_consolidation_events_trigger` ON `brain_consolidation_events` (`trigger`);
|
|
72
|
+
--> statement-breakpoint
|
|
73
|
+
CREATE INDEX IF NOT EXISTS `idx_consolidation_events_session` ON `brain_consolidation_events` (`session_id`);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
-- T726 Wave 1A: Memory dedup gates + tier promotion audit columns
|
|
2
|
+
--
|
|
3
|
+
-- T741 + T743: Add tier_promoted_at + tier_promotion_reason to all 4 memory tables.
|
|
4
|
+
-- Enables auditable promotion history without a separate log table.
|
|
5
|
+
-- T737: Add content_hash to brain_decisions, brain_patterns, brain_learnings.
|
|
6
|
+
-- All three tables had the column in the original design intent (hash-dedup for all
|
|
7
|
+
-- typed tables) but it was only added to brain_observations in T033. This migration
|
|
8
|
+
-- closes the gap so hashDedupCheck() can gate all four tables.
|
|
9
|
+
-- T746: No DDL needed — the DEFAULT 'medium' fix is a Drizzle-schema-only correction.
|
|
10
|
+
-- Existing rows already have 'medium' assigned by the write-path; only the Drizzle
|
|
11
|
+
-- column declaration was wrong (DEFAULT 'short' vs 'medium').
|
|
12
|
+
--
|
|
13
|
+
-- All ALTER statements are idempotent-safe: columns are nullable, added after existing
|
|
14
|
+
-- columns, no NOT NULL without a default.
|
|
15
|
+
|
|
16
|
+
-- ============================================================
|
|
17
|
+
-- brain_decisions — tier promotion audit + content_hash
|
|
18
|
+
-- ============================================================
|
|
19
|
+
|
|
20
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `tier_promoted_at` text;
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `tier_promotion_reason` text;
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
ALTER TABLE `brain_decisions` ADD COLUMN `content_hash` text;
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
|
|
27
|
+
-- ============================================================
|
|
28
|
+
-- brain_patterns — tier promotion audit + content_hash
|
|
29
|
+
-- ============================================================
|
|
30
|
+
|
|
31
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `tier_promoted_at` text;
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `tier_promotion_reason` text;
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
ALTER TABLE `brain_patterns` ADD COLUMN `content_hash` text;
|
|
36
|
+
--> statement-breakpoint
|
|
37
|
+
|
|
38
|
+
-- ============================================================
|
|
39
|
+
-- brain_learnings — tier promotion audit + content_hash
|
|
40
|
+
-- ============================================================
|
|
41
|
+
|
|
42
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `tier_promoted_at` text;
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `tier_promotion_reason` text;
|
|
45
|
+
--> statement-breakpoint
|
|
46
|
+
ALTER TABLE `brain_learnings` ADD COLUMN `content_hash` text;
|
|
47
|
+
--> statement-breakpoint
|
|
48
|
+
|
|
49
|
+
-- ============================================================
|
|
50
|
+
-- brain_observations — tier promotion audit only
|
|
51
|
+
-- (content_hash already exists from T033)
|
|
52
|
+
-- ============================================================
|
|
53
|
+
|
|
54
|
+
ALTER TABLE `brain_observations` ADD COLUMN `tier_promoted_at` text;
|
|
55
|
+
--> statement-breakpoint
|
|
56
|
+
ALTER TABLE `brain_observations` ADD COLUMN `tier_promotion_reason` text;
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
|
|
59
|
+
-- ============================================================
|
|
60
|
+
-- Indexes on tier_promoted_at for promotion history queries
|
|
61
|
+
-- ============================================================
|
|
62
|
+
|
|
63
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_tier_promoted_at` ON `brain_decisions` (`tier_promoted_at`);
|
|
64
|
+
--> statement-breakpoint
|
|
65
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_tier_promoted_at` ON `brain_patterns` (`tier_promoted_at`);
|
|
66
|
+
--> statement-breakpoint
|
|
67
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_tier_promoted_at` ON `brain_learnings` (`tier_promoted_at`);
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_observations_tier_promoted_at` ON `brain_observations` (`tier_promoted_at`);
|
|
70
|
+
--> statement-breakpoint
|
|
71
|
+
|
|
72
|
+
-- Indexes on content_hash for the new typed tables (mirrors obs index pattern)
|
|
73
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_decisions_content_hash` ON `brain_decisions` (`content_hash`);
|
|
74
|
+
--> statement-breakpoint
|
|
75
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_patterns_content_hash` ON `brain_patterns` (`content_hash`);
|
|
76
|
+
--> statement-breakpoint
|
|
77
|
+
CREATE INDEX IF NOT EXISTS `idx_brain_learnings_content_hash` ON `brain_learnings` (`content_hash`);
|