@cleocode/cleo 2026.4.68 → 2026.4.70

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.
@@ -0,0 +1,58 @@
1
+ -- T790 BRAIN-01: Prune Hebbian co_retrieved noise edges
2
+ --
3
+ -- Context (T764 audit): 6,026 `co_retrieved` edges were emitted by the
4
+ -- Hebbian strengthener because it counted raw log row co-occurrences rather
5
+ -- than distinct query strings. With limit>=5 per query, N*(N-1)/2 pairs were
6
+ -- generated per retrieval call, and the count>=3 threshold was hit after just
7
+ -- 3 runs of any search that returned overlapping results.
8
+ --
9
+ -- Fix applied in brain-lifecycle.ts (T790): `strengthenCoRetrievedEdges` now
10
+ -- tracks distinct query strings per pair (Map<key, Set<query>>) and requires
11
+ -- >= 3 DIFFERENT query strings before emitting an edge. Repeated searches no
12
+ -- longer inflate the count.
13
+ --
14
+ -- This migration prunes the existing noise. The owner decision rule is:
15
+ -- - Preserve strong signals: weight >= 0.3 (0.3 = original insert weight,
16
+ -- meaning at least one real consolidation touch)
17
+ -- - Delete obvious noise: weight < 0.3 (fractional leftovers, never
18
+ -- received a full consolidation cycle)
19
+ -- - Delete all edges created before this fix date (2026-04-16) because none
20
+ -- of them passed the distinct-query gate — they were all created under the
21
+ -- broken raw-count path.
22
+ --
23
+ -- Reversibility: the DELETE only removes `co_retrieved` edges with
24
+ -- plasticity_class IN ('hebbian', 'static') and weight < 0.3. STDP-upgraded
25
+ -- edges (plasticity_class='stdp') are PRESERVED regardless of weight, as STDP
26
+ -- applies its own timing window and is considered higher-signal.
27
+ -- This migration is no-op-safe: if no matching rows exist, the DELETE is a
28
+ -- no-op with zero changes.
29
+
30
+ -- ============================================================
31
+ -- Step 1: Delete low-weight hebbian co_retrieved noise edges
32
+ -- ============================================================
33
+
34
+ DELETE FROM brain_page_edges
35
+ WHERE edge_type = 'co_retrieved'
36
+ AND plasticity_class IN ('hebbian', 'static')
37
+ AND weight < 0.3;
38
+ --> statement-breakpoint
39
+
40
+ -- ============================================================
41
+ -- Step 2: Delete all co_retrieved edges created before the
42
+ -- T790 fix date, EXCEPT those upgraded to 'stdp' class
43
+ -- (STDP-upgraded edges carried timing signal, keep them).
44
+ -- ============================================================
45
+
46
+ DELETE FROM brain_page_edges
47
+ WHERE edge_type = 'co_retrieved'
48
+ AND plasticity_class IN ('hebbian', 'static')
49
+ AND created_at < '2026-04-16 00:00:00';
50
+ --> statement-breakpoint
51
+
52
+ -- ============================================================
53
+ -- Step 3: Index guard — ensure edge lookup is efficient
54
+ -- (idempotent CREATE IF NOT EXISTS)
55
+ -- ============================================================
56
+
57
+ CREATE INDEX IF NOT EXISTS `idx_brain_page_edges_type_plasticity`
58
+ ON `brain_page_edges` (`edge_type`, `plasticity_class`);
@@ -0,0 +1,36 @@
1
+ -- T796: Content-addressed attachment storage
2
+ --
3
+ -- Adds two tables to tasks.db:
4
+ -- attachments — registry of all attachment blobs (content-addressed by sha256)
5
+ -- attachment_refs — ref-counted junction table linking attachments to owner entities
6
+ --
7
+ -- Storage layout: .cleo/attachments/sha256/<prefix2>/<rest>.<ext>
8
+ -- The `attachment_json` column stores the serialised Attachment discriminated union.
9
+ --
10
+ -- @epic T760
11
+ -- @task T796
12
+
13
+ CREATE TABLE IF NOT EXISTS `attachments` (
14
+ `id` text PRIMARY KEY NOT NULL,
15
+ `sha256` text NOT NULL,
16
+ `attachment_json` text NOT NULL,
17
+ `created_at` text NOT NULL,
18
+ `ref_count` integer NOT NULL DEFAULT 0
19
+ );
20
+ --> statement-breakpoint
21
+ CREATE UNIQUE INDEX IF NOT EXISTS `idx_attachments_sha256` ON `attachments` (`sha256`);
22
+ --> statement-breakpoint
23
+
24
+ CREATE TABLE IF NOT EXISTS `attachment_refs` (
25
+ `attachment_id` text NOT NULL,
26
+ `owner_type` text NOT NULL,
27
+ `owner_id` text NOT NULL,
28
+ `attached_at` text NOT NULL,
29
+ `attached_by` text,
30
+ CONSTRAINT `attachment_refs_pk` PRIMARY KEY(`attachment_id`, `owner_type`, `owner_id`),
31
+ CONSTRAINT `fk_attachment_refs_attachment_id` FOREIGN KEY (`attachment_id`) REFERENCES `attachments`(`id`) ON DELETE CASCADE
32
+ );
33
+ --> statement-breakpoint
34
+ CREATE INDEX IF NOT EXISTS `idx_attachment_refs_owner` ON `attachment_refs` (`owner_type`, `owner_id`);
35
+ --> statement-breakpoint
36
+ CREATE INDEX IF NOT EXISTS `idx_attachment_refs_attachment_id` ON `attachment_refs` (`attachment_id`);
@@ -0,0 +1,10 @@
1
+ -- T811: IVTR orchestration harness — phase state column on tasks
2
+ --
3
+ -- Adds `ivtr_state` to the `tasks` table.
4
+ -- Value is a nullable JSON serialisation of IvtrState.
5
+ -- NULL = task has never entered the IVTR loop.
6
+ --
7
+ -- @epic T810
8
+ -- @task T811
9
+
10
+ ALTER TABLE `tasks` ADD COLUMN `ivtr_state` text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/cleo",
3
- "version": "2026.4.68",
3
+ "version": "2026.4.70",
4
4
  "description": "CLEO CLI — the assembled product consuming @cleocode/core",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",
@@ -28,13 +28,13 @@
28
28
  "tree-sitter-ruby": "^0.23.1",
29
29
  "tree-sitter-rust": "0.23.1",
30
30
  "tree-sitter-typescript": "^0.23.2",
31
- "@cleocode/caamp": "2026.4.68",
32
- "@cleocode/cant": "2026.4.68",
33
- "@cleocode/contracts": "2026.4.68",
34
- "@cleocode/core": "2026.4.68",
35
- "@cleocode/lafs": "2026.4.68",
36
- "@cleocode/nexus": "2026.4.68",
37
- "@cleocode/runtime": "2026.4.68"
31
+ "@cleocode/caamp": "2026.4.70",
32
+ "@cleocode/cant": "2026.4.70",
33
+ "@cleocode/core": "2026.4.70",
34
+ "@cleocode/lafs": "2026.4.70",
35
+ "@cleocode/contracts": "2026.4.70",
36
+ "@cleocode/nexus": "2026.4.70",
37
+ "@cleocode/runtime": "2026.4.70"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=24.0.0"