-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.sql
More file actions
44 lines (42 loc) · 1.75 KB
/
schema.sql
File metadata and controls
44 lines (42 loc) · 1.75 KB
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
-- knowledge-pipeline schema v1.0
-- Single-file SQLite database for the full pipeline.
CREATE TABLE IF NOT EXISTS items (
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT NOT NULL UNIQUE,
domain TEXT,
title TEXT,
-- Ingestion
added_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
source TEXT DEFAULT 'cli', -- cli / file / api
-- Enrichment (Layer 2)
full_text TEXT,
summary TEXT,
core_insight TEXT,
fetch_status TEXT DEFAULT 'pending', -- pending / fetched / failed / skipped
fetched_at TEXT,
-- Scoring (Layer 3)
knowledge_density INTEGER,
novelty INTEGER,
evidence_strength INTEGER,
actionability INTEGER,
risk_level INTEGER,
time_horizon TEXT, -- short / mid / long
emotional_noise INTEGER,
source_credibility INTEGER,
signal_score INTEGER, -- composite 0-100
route_to TEXT, -- research / writer / action / validator / archive
decision_reason TEXT,
scored_at TEXT,
prompt_version TEXT,
-- Embedding (Layer 4)
embedding TEXT, -- JSON array (dense vector)
sparse_weights TEXT, -- JSON object (sparse vector)
embedded_at TEXT,
-- Metadata
url_hash TEXT, -- SHA256 of URL for dedup
tags TEXT -- JSON array
);
CREATE INDEX IF NOT EXISTS idx_items_domain ON items(domain);
CREATE INDEX IF NOT EXISTS idx_items_signal ON items(signal_score);
CREATE INDEX IF NOT EXISTS idx_items_route ON items(route_to);
CREATE INDEX IF NOT EXISTS idx_items_fetch ON items(fetch_status);