Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

chore(ultrawiki): clear design docs (recoverable via git history)

Ruben Lütke1f1bd7d7b2c8
diff --git a/UltraWiki/01-architecture.md b/UltraWiki/01-architecture.md
deleted file mode 100644
index 35317315ef..0000000000
--- a/UltraWiki/01-architecture.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# 01 · Architecture
-
-Five layers. Data flows **down** on the write path and **up** on the read path.
-The middle layer — the **Unified Store** — is the whole point: everything from
-every source lands in one schema and becomes queryable through one interface.
-
-```
- WRITE PATH ↓ READ PATH ↑
- ┌─────────────────────────────────────────────────────────────────┐
- │ L1 CONNECTORS Slack · WhatsApp · GitHub · Drive · Cal · │
- │ Notion · Mail · Obsidian · Screenshots │
- ├─────────────────────────────────────────────────────────────────┤
- │ L2 INGEST & ENRICH fetch delta → distill (LLM) → extract │
- │ entities/relations/time → embed │
- ├─────────────────────────────────────────────────────────────────┤
- │ L3 UNIFIED STORE one row per unit: │
- │ ├ vector index (HNSW) ← meaning │
- │ ├ FTS5 index ← exact tokens │
- │ ├ metadata indexes ← who/where/when filters │
- │ └ entity+temporal graph ← multi-hop, bi-temporal │
- ├─────────────────────────────────────────────────────────────────┤
- │ L4 HYBRID RETRIEVAL plan → parallel fan-out → RRF → rerank → │
- │ context expansion │
- ├─────────────────────────────────────────────────────────────────┤
- │ L5 ANSWER synthesis LLM → cited answer / voice │
- └─────────────────────────────────────────────────────────────────┘
-```
-
-Legend for the reuse tags used across the docs: **[HAVE]** exists in Jarvis
-today · **[EXTEND]** exists but needs a small addition · **[NEW]** genuinely new.
-
----
-
-## L3 — the Unified Store (the core data model)
-
-Two tables plus the derived indexes. Everything is keyed so ingestion is
-**idempotent** (re-processing the same source item updates in place, never
-duplicates).
-
-### Table A — `memory_unit` (one row per distilled unit)
-
-| Field | Purpose |
-|---|---|
-| `id` | internal primary key |
-| `source` | `slack` \| `whatsapp` \| `github` \| `drive` \| `calendar` \| `notion` \| `mail` \| `obsidian` \| `screenshot` |
-| `external_id` | stable id in the source (thread ts, file id, PR number) — **dedup/update key** |
-| `kind` | `message_thread` \| `doc_section` \| `pr` \| `issue` \| `event` \| `note` \| `email` \| `image` |
-| `one_line` | the searchable "what is this about" question/summary |
-| `distilled_text` | the LLM-normalized document — **this is what gets embedded**, not the raw text |
-| `raw_ref` | URI/pointer back to the original (open in Slack/Drive); raw text is *not* stored |
-| `embedding` | dense vector (dim = provider's, e.g. 1024–3072) → HNSW index |
-| `participants` | array of entity ids (people in the unit) → metadata index |
-| `place` | entity id / geo string → metadata index |
-| `valid_from`, `valid_to` | **bi-temporal**: when the fact was true in the world |
-| `ingested_at`, `expired_at` | **bi-temporal**: system time; supersede, don't delete |
-| `scope` | project/permission tag (which sources a query may see) |
-| `source_meta` | JSON blob: author, url, reactions, thread length, etc. |
-
-Local backend: **sqlite-vec** on the existing `data/jarvis.db` (the `wiki_fts`
-table already lives there). Cloud backend: **Postgres + pgvector**. Same schema,
-swappable driver.
-
-### Table B — the entity/temporal graph (GraphRAG + Graphiti style)
-
-- **`entity`**: `id`, `type` (`person` \| `place` \| `org` \| `project` \|
- `event` \| `thing`), `name`, `aliases[]`, `canonical_ref` (e.g. a Jarvis
- Contact id — **[HAVE]** contacts already exist), `embedding` (for fuzzy entity
- match).
-- **`edge`**: `subject → predicate → object`, each carrying `valid_from`,
- `valid_to`, `source_unit_id`, `confidence`. Facts are **invalidated, not
- deleted** when superseded (Graphiti's rule) — so "who is Viktoria *now*" and
- "who was Viktoria *in 2024*" are both answerable.
-
-Example edges written from one WhatsApp thread:
-
-```
-(Ruben) —[had_dinner_with]→ (Viktoria) valid_from=2024-06-23 src=wa#123
-(dinner#88) —[took_place_in]→ (San Francisco) valid_from=2024-06-23
-(dinner#88) —[at_venue]→ (Trestle)
-(Viktoria) —[is_a]→ (person) canonical_ref=contact:viktoria-m
-```
-
-This graph is what makes the Viktoria query precise instead of "semantically
-nearby". See [`04-accuracy-techniques.md`](04-accuracy-techniques.md).
-
----
-
-## Why one store, not one-per-source
-
-Cerebras's key move: a Slack thread, a PR, a Drive doc, a calendar event all
-become **the same shape** — a distilled document with a vector and metadata. A
-query never has to know "which source do I search"; it searches the union and the
-metadata/scope tags sort out provenance and permissions. New sources join by
-emitting rows in this schema — no retrieval code changes.
-
----
-
-## Where each layer maps in Jarvis (short form; full map in doc 07)
-
-| Layer | Jarvis today |
-|---|---|
-| L1 Connectors | `marketplace/` OAuth, `channels/`, `plugins/tool/` (Drive, Calendar), wiki `watcher.py` **[EXTEND]** |
-| L2 Distill | `wiki/extractor.py` + `consolidator.py` + `curator.py` **[HAVE]**; + embed step **[NEW]** |
-| L3 Store | `data/jarvis.db` + `wiki_fts` **[HAVE]**; + vector index + graph tables **[NEW]** |
-| L4 Retrieval | `wiki/search.py` (FTS) **[HAVE]**; + vector/graph/fusion/rerank **[NEW]** |
-| L5 Answer | `provider_chain.py` **[HAVE]** |
diff --git a/UltraWiki/02-ingestion-write-path.md b/UltraWiki/02-ingestion-write-path.md
deleted file mode 100644
index 7ccf794ae6..0000000000
--- a/UltraWiki/02-ingestion-write-path.md
+++ /dev/null
@@ -1,140 +0,0 @@
-# 02 · Ingestion — the Write Path ("always the latest data")
-
-This is where "it always pulls the newest data" is earned. The goal: the moment
-someone posts in a Slack/WhatsApp thread, that knowledge is in the brain within
-seconds — **without** re-scanning the whole history each time.
-
-```
- SOURCE CHANGES ─► (1) TRIGGER ─► (2) FETCH DELTA ─► (3) DISTILL(LLM)
- ─► (4) EXTRACT entities/relations/time(LLM) ─► (5) EMBED
- ─► (6) UPSERT unit + graph edges ─► (7) CONSOLIDATE (add/update/invalidate)
-```
-
-Steps 3–7 are exactly Jarvis's existing `extractor → consolidator → curator →
-atomic_writer` pipeline, plus an embed step. So the write path is mostly reuse.
-
----
-
-## (1) Trigger — three ways to know something changed
-
-The connector declares **how it learns about changes**. Pick per source; prefer
-push over poll.
-
-| Strategy | How | Best for | Jarvis today |
-|---|---|---|---|
-| **Push / realtime** | the source calls us: webhook or a socket the bot holds open | Slack (Socket Mode WS), GitHub/Notion (webhooks), Telegram/Discord (bot gateway), Obsidian (filesystem watcher) | `channels/` bots + wiki `watcher.py` **[HAVE]** |
-| **Cursor poll (CDC)** | we ask on an interval, but only for items **after a stored cursor** (sync token / page token / IMAP `IDLE`) | Google Drive (changes feed), Calendar (sync tokens), e-mail | Drive/Calendar tools exist **[EXTEND]** |
-| **Backfill (one-time)** | on first connect, import bounded history, rate-limited, in the background | every source, once | **[NEW]** |
-
-**"Actions" the user asked about** = this trigger layer. In practice it is a mix
-of webhooks/sockets (instant) and cursor-based polling (for sources that don't
-push). The important part is **incremental**: every source stores a
-`last_cursor` / `last_seen_ts`, and each run only touches the delta.
-
-### Idempotency & completeness (two Cerebras tricks worth copying)
-
-- **Re-fetch the whole thread on any reply.** When one new Slack/WhatsApp message
- arrives, fetch the *entire parent thread* and store it as **one** unit keyed by
- `external_id = thread_id`. An update replaces the row — the unit is always
- complete, never a pile of fragments.
-- **`external_id` upsert.** Same source item → same row, always. Reprocessing is
- safe; no duplicates.
-
----
-
-## (2) Fetch delta
-
-The connector returns raw items for the changed `external_id`s. Raw text is
-**transient** — used for distillation, then dropped (only `raw_ref` is kept). This
-keeps the store small and side-steps storing giant transcripts.
-
-Durability: enqueue fetched items on a work queue so bursts (a busy channel)
-don't drop and don't block. Jarvis's `EventBus` + a lightweight persistent queue
-covers this; a crash mid-ingest resumes from the cursor.
-
----
-
-## (3) Distill — the single biggest accuracy lever
-
-Do **not** embed raw messages. An LLM rewrites each unit into a normalized
-document with fixed fields:
-
-- `one_line` — the question this unit answers ("Dinner plan with Viktoria in SF")
-- `summary` — 2–4 sentences, self-contained
-- `resolution / outcome` — what was decided/what happened
-- `entities` — people, places, orgs, dates mentioned
-- `refs` — systems, files, links referenced
-
-Then, per **Anthropic Contextual Retrieval**, prepend a short **context prefix**
-("This is a WhatsApp thread between Ruben and Viktoria, June 2024, about…") to the
-text *before* embedding. Anthropic measured **−49% failed retrievals** from this
-alone, **−67%** combined with reranking. This is cheap and it is where most of the
-accuracy comes from.
-
-> Speed note: distillation is many small LLM calls. This is exactly why Cerebras
-> stresses that **fast inference enables the architecture** — with a fast model
-> you can afford to distill everything. Distillation is off the hot path (runs in
-> the background on ingest), so it never touches query latency.
-
----
-
-## (4) Extract entities, relations, time (the graph write)
-
-The same or a second LLM pass emits graph triples with timestamps:
-
-```
-(Ruben)—[had_dinner_with]→(Viktoria) valid_from=2024-06-23 src=wa#123 conf=0.9
-(event#88)—[at_venue]→(Trestle, San Francisco) valid_from=2024-06-23
-```
-
-- **Entity resolution on write:** "Viktoria" is linked to the existing Contact
- (alias match + embedding similarity) so all her mentions collapse to one node.
- Jarvis already builds person-pages from contacts (`contact_mirror.py`) — extend
- it to graph nodes.
-- **Bi-temporal (Graphiti):** store both *when the fact was true* (`valid_from/to`)
- and *when we learned it* (`ingested_at/expired_at`). When a later message
- contradicts an earlier fact, **invalidate** the old edge (set `valid_to`),
- don't delete it. History stays answerable.
-- **Relative-time resolution:** "last Tuesday" is resolved to an absolute date
- using the message's own timestamp as the reference point.
-
----
-
-## (5) Embed
-
-`distilled_text` (+ context prefix) → dense vector via the configured embedding
-provider (local Ollama model or a cloud API — see doc 06). Only changed units are
-re-embedded, per commit/edit. Optionally also compute a **ColPali multi-vector**
-for image/screenshot/PDF units (doc 04, VisionRAG).
-
----
-
-## (6) Upsert
-
-One transaction writes: the `memory_unit` row (updating the vector, FTS, metadata,
-bi-temporal fields) and the graph edges. `atomic_writer.py` already does
-lock+tempfile+BOM-safe writes for the vault (AP-7) — the DB upsert follows the
-same atomic discipline.
-
----
-
-## (7) Consolidate
-
-Jarvis's `consolidator.py` already judges **ADD / UPDATE / NOOP / INVALIDATE**
-against existing knowledge. UltraWiki extends this to the graph: a new fact that
-contradicts an old one triggers **INVALIDATE** (bi-temporal supersede) rather than
-a silent overwrite. This is what keeps the brain consistent instead of
-accumulating contradictions.
-
----
-
-## End-to-end example (one WhatsApp message triggers all of this)
-
-1. Viktoria replies in the SF-dinner thread → **Socket push**.
-2. Jarvis re-fetches the **full thread** (external_id = `wa#123`).
-3. LLM distills → `one_line: "Dinner with Viktoria at Trestle, SF, 23 Jun"`.
-4. Extract → edges `(Ruben)-[had_dinner_with]->(Viktoria) @ SF, 2024-06-23`.
-5. Embed the distilled doc (+ context prefix).
-6. Upsert row `wa#123` (replaces the earlier version) + edges.
-7. Consolidate: no conflict → **UPDATE**. Done, in seconds. The brain can now
- answer the north-star question.
diff --git a/UltraWiki/03-retrieval-read-path.md b/UltraWiki/03-retrieval-read-path.md
deleted file mode 100644
index 4d410b2d8e..0000000000
--- a/UltraWiki/03-retrieval-read-path.md
+++ /dev/null
@@ -1,136 +0,0 @@
-# 03 · Retrieval — the Read Path (fast + exact)
-
-This is the live path. It must return a cited, exact answer in a budget the
-**realtime voice model** can live with (first token well under ~1 s). The trick is
-that all the expensive work (distilling, embedding, graph-building) already
-happened on the write path — the read path is mostly index lookups plus two small
-LLM calls (plan + synthesize).
-
-```
- QUESTION
- └─(1) PLAN (LLM) → {entities, place, time-window, semantic core, sources}
- └─(2) RESOLVE ENTITIES → "Viktoria" → contact:viktoria-m ; "SF" → place node
- └─(3) FAN-OUT (parallel, all metadata-prefiltered)
- ├ vector search (meaning) ┐
- ├ FTS5 search (exact tokens) │→ candidate sets
- ├ graph traversal (multi-hop) │
- └ temporal filter (time-window) ┘
- └─(4) FUSE (RRF) → one ranked list
- └─(5) RERANK (cross-encoder) → top few
- └─(6) EXPAND CONTEXT → pull full thread / calendar event / photo
- └─(7) SYNTHESIZE (LLM) → cited answer
-```
-
----
-
-## (1) Plan — turn a vague question into structured facets
-
-A single fast LLM call converts the question into a query object. This is where
-"even if the user describes it imprecisely" is handled.
-
-For **"Wann war ich mit Viktoria beim Essen in San Francisco?"**: <!-- i18n-allow: quoted German example query — the specimen being traced through the pipeline -->
-
-```json
-{
- "intent": "temporal_lookup", // the answer is a DATE
- "entities": { "person": ["Viktoria"], "place": ["San Francisco"] },
- "activity": "dinner | restaurant | essen",
- "time_window": null, // unspecified → all-time
- "sources": ["whatsapp", "slack", "calendar"],
- "semantic_core": "dinner with Viktoria in San Francisco"
-}
-```
-
-Optional **HyDE** (Hypothetical Document Embeddings): for very vague queries, the
-LLM also writes a fake ideal answer and embeds *that* — it often matches the real
-distilled unit better than the raw question. Use only when the plan is thin;
-skip it when metadata filters are strong (they usually are here).
-
----
-
-## (2) Resolve entities — the accuracy multiplier
-
-"Viktoria" is ambiguous text; the graph needs a **node id**. Resolve via the
-contact store (alias + embedding match) → `contact:viktoria-m`. "San Francisco" →
-place node. Now retrieval can **filter on ids**, not fuzzy strings — which is the
-difference between "restaurants that sound like something Viktoria-ish" and
-"units where participant = Viktoria AND place = San Francisco".
-
-Jarvis already has contacts and person-pages — this reuses them.
-
----
-
-## (3) Fan-out — four retrievers in parallel, all pre-filtered
-
-The metadata filter (`participants ⊇ {Viktoria} AND place ≈ SF`) runs **first**
-and shrinks the search space from years-of-everything to a handful of candidates.
-Then the four retrievers run **concurrently**:
-
-| Retriever | Finds | Why it's needed here |
-|---|---|---|
-| **Vector** | meaning: "dinner ≈ essen ≈ restaurant reservation" | catches paraphrase; the user's word "Essen" ≠ the thread's word "reservation" |
-| **FTS5** | exact tokens: "Viktoria", "San Francisco", "Trestle" | nails proper nouns embeddings blur |
-| **Graph** | `Viktoria —had_dinner_with→ event —in→ SF` with its date | this is what actually produces the exact date, by traversal not similarity |
-| **Temporal** | orders/filters candidates by `valid_from` | if the user *had* said "in June" this narrows hard |
-
-The graph retriever is the star of this particular query: a two-hop traversal
-from the resolved Viktoria node to dinner-events located in SF returns the event
-with its `valid_from` date directly — no ranking needed to *find* it, only to
-confirm it.
-
----
-
-## (4) Fuse — Reciprocal Rank Fusion
-
-Merge the four ranked lists into one with RRF: `score(d) = Σ 1/(k + rank_i(d))`,
-`k=60`. RRF needs no score calibration between retrievers (a vector cosine and a
-BM25 score aren't comparable) — it only uses ranks, which is why it's the
-production standard. Anthropic's default leans ~80% semantic / 20% keyword;
-tunable.
-
----
-
-## (5) Rerank — precision on the shortlist
-
-Pass the top ~50–150 fused candidates through a small **cross-encoder reranker**
-that scores query-vs-document jointly (0–10) and keep the top few. Anthropic:
-reranking is what takes contextual retrieval from −49% to **−67% failed
-retrievals**. Local option: a small cross-encoder; cloud option: Cohere Rerank;
-zero-key fallback: an LLM-rerank through `provider_chain`, or skip reranking (RRF
-alone is decent). Keep it optional so a keyless install still works.
-
----
-
-## (6) Expand context
-
-For the surviving top hits, pull the **neighbourhood**: the full WhatsApp thread,
-the linked calendar event, the venue's other mentions, an attached photo. This
-gives the synthesis LLM complete evidence instead of a snippet, so it can state
-the exact venue and cross-confirm the date across two sources.
-
----
-
-## (7) Synthesize — cited answer
-
-The synthesis LLM (via `provider_chain`) gets the plan + expanded evidence and
-writes:
-
-> **"On 23 June 2024 you had dinner with Viktoria at Trestle in San Francisco."**
-> Sources: WhatsApp thread (23 Jun 2024) · Calendar 'Dinner w/ Viktoria'.
-
-Rules: **never answer beyond the evidence** (no hallucinated dates — if only a
-month is known, say the month), always cite, and honour the runtime output
-language resolver so voice answers come back in the conversation's language.
-
-For **voice/realtime**, the answer streams token-by-token; first token is the
-latency that matters, not the full answer (see doc 05).
-
----
-
-## Two interfaces (like Cerebras)
-
-- **Full pipeline** — the above, for the user asking Jarvis (voice or UI).
-- **Retrieval primitives (MCP)** — expose `search_unified`, `graph_lookup`,
- `who_knows`, `timeline` as MCP tools with **no synthesis LLM**, so external
- agents (or Jarvis's own workers) can pull raw evidence fast. This is doc 08's
- Phase 4 and turns the personal brain into a platform.
diff --git a/UltraWiki/04-accuracy-techniques.md b/UltraWiki/04-accuracy-techniques.md
deleted file mode 100644
index aaa5534348..0000000000
--- a/UltraWiki/04-accuracy-techniques.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# 04 · Accuracy Techniques — how to be *exact* on vague questions
-
-The whole point of UltraWiki over a naïve vector store. Each technique below
-attacks a specific failure mode of "just embed chunks and cosine-search". They
-stack; the design uses all of them, gated so a keyless install still degrades to
-something useful.
-
-| # | Technique | Failure mode it fixes | Cost | Priority |
-|---|---|---|---|---|
-| 1 | Contextual distillation | chunks lose context; paraphrase misses | ingest-time LLM | **must** |
-| 2 | Hybrid search (vector + FTS) | embeddings blur exact tokens | cheap | **must** |
-| 3 | Entity resolution | "Viktoria" ≠ a searchable id | contacts reuse | **must** |
-| 4 | Temporal / bi-temporal graph | "when" questions; stale facts | graph store | **must** |
-| 5 | GraphRAG multi-hop | relational questions ("who did X with Y") | graph store | **high** |
-| 6 | RRF fusion | scores across retrievers aren't comparable | trivial | **must** |
-| 7 | Reranking | top-k precision | small model | **high** |
-| 8 | HyDE / query expansion | very vague queries | 1 LLM call | medium |
-| 9 | VisionRAG (ColPali) | screenshots/photos/PDFs, no OCR | vision model | later |
-| 10 | Metadata prefiltering | searching everything is slow & noisy | trivial | **must** |
-
----
-
-## 1 · Contextual distillation (the biggest single win)
-
-Rewrite each unit into a self-contained document and **prepend a context
-sentence** before embedding (Anthropic Contextual Retrieval). A raw line "yeah
-Trestle at 8" is useless embedded; distilled to "Dinner with Viktoria at Trestle,
-San Francisco, 23 Jun 2024, 20:00" it matches the query directly. Measured
-**−49% failed retrievals**, **−67%** with reranking. Done on the write path (doc
-02), so it's free at query time.
-
-## 2 · Hybrid search (vector + keyword)
-
-Vector finds meaning ("Essen" ≈ "dinner"); FTS5 finds exact strings ("Trestle",
-error codes, hostnames, `--flags`) that embeddings smear together. You need both.
-Jarvis has FTS5 today; vector is the new half. Merge with RRF (#6).
-
-## 3 · Entity resolution
-
-Collapse every mention/alias of a person/place/thing to one canonical node
-(reusing Jarvis contacts). Turns fuzzy text matching into exact id filtering —
-the single biggest precision lever for "questions about a specific person". Do it
-**on write** (link mentions to contacts) and **on read** (resolve query names to
-ids).
-
-## 4 · Temporal & bi-temporal (Graphiti/Zep model)
-
-Every fact and edge carries two timelines:
-
-- **valid-time** — when it was true in the world (`valid_from/valid_to`)
-- **ingestion-time** — when we learned it (`ingested_at/expired_at`)
-
-This is what makes "**when** was I with Viktoria" answerable at all, and what lets
-"who is my manager" return the *current* answer while "who was my manager in 2023"
-returns the historical one. Superseded facts are **invalidated, not deleted**.
-Without this, a memory system either forgets or contradicts itself. Graphiti is
-the open-source reference implementation (Neo4j-based) if you don't want to build
-the temporal layer from scratch.
-
-## 5 · GraphRAG (multi-hop relational retrieval)
-
-Pure similarity can't answer "who did I travel with to the offsite that Anna
-organized" — that's three hops. A knowledge graph traverses `Anna →organized→
-offsite →attended_by→ {people}`. For UltraWiki the graph is entity-centric
-(people/places/events/projects). Microsoft GraphRAG's community-summarization is
-overkill for a personal brain; the lightweight entity-graph + traversal is the
-right size. The graph is also what returns **exact facts** (a date, a venue) by
-lookup instead of by ranking.
-
-> **On "Mantis":** no established RAG framework by that name was found. The intent
-> — a graph/temporal memory that answers relational + time questions precisely —
-> is exactly techniques #4 and #5, best embodied by **Graphiti/Zep**. If a
-> specific tool was meant, flag it and it can be slotted in here.
-
-## 6 · Reciprocal Rank Fusion
-
-Combine retriever outputs by **rank**, not score: `Σ 1/(60+rank)`. No calibration
-needed between incomparable scorers. De-facto standard.
-
-## 7 · Reranking
-
-A cross-encoder re-scores the shortlist jointly (query×doc), far more precise than
-bi-encoder cosine. Retrieve wide (top ~150), rerank to a tight top-k. Optional
-(local cross-encoder / Cohere / LLM-rerank / skip) so it never becomes a hard
-dependency.
-
-## 8 · HyDE & query expansion
-
-For thin/vague queries, have the LLM (a) generate a hypothetical ideal answer and
-embed that, and/or (b) expand synonyms and the user's language ("Essen" → dinner,
-meal, restaurant). Use selectively — strong metadata filters usually make it
-unnecessary and it adds a call.
-
-## 9 · VisionRAG (ColPali / ColQwen2) — for later
-
-Screenshots, photos of receipts/whiteboards, and visually-rich PDFs lose their
-meaning through OCR. ColPali embeds the **page image** as multi-vector patch
-embeddings and scores with late-interaction MaxSim — retrieving figures, tables,
-and layout that text extraction misses, no OCR pipeline. Relevant once the brain
-ingests images (a photo from the Viktoria dinner, a screenshot of a reservation).
-Store the ColPali multi-vector alongside the unit; keep it an opt-in extra
-(needs a vision model). Byaldi is the easy wrapper.
-
-## 10 · Metadata prefiltering
-
-Before any similarity work, filter by the resolved facets (participant, place,
-time, source, scope). Shrinks the candidate set by orders of magnitude → both
-faster (doc 05) and more precise (less room for a semantically-close-but-wrong
-hit). Cheap and always on.
-
----
-
-## How they combine for the north-star query
-
-`Viktoria` (resolve→id) + `SF` (resolve→place) → **prefilter** (#10) → **graph
-hop** finds the dinner event with its date (#4/#5) while **vector+FTS** (#1/#2)
-confirm the thread → **RRF** (#6) → **rerank** (#7) → **cited answer**. Six of the
-ten techniques fire on this one question — that's why it lands the exact date
-instead of "some restaurant, maybe".
diff --git a/UltraWiki/05-performance-realtime.md b/UltraWiki/05-performance-realtime.md
deleted file mode 100644
index 463ea89dd0..0000000000
--- a/UltraWiki/05-performance-realtime.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# 05 · Performance — fast enough for the realtime voice model
-
-Target: a spoken question returns its **first token in ≲ 800 ms**, so UltraWiki
-feels like part of the conversation, not a lookup. The full answer streams after.
-This is achievable because the heavy work is pre-computed on the write path.
-
-## The latency budget (read path, personal-scale, local sqlite-vec)
-
-| Stage | Typical | Note |
-|---|---|---|
-| Plan (LLM) | 50–150 ms | one small/fast call; Cerebras-class inference makes this ~free |
-| Entity resolve | < 5 ms | local id lookup |
-| Metadata prefilter | < 10 ms | indexed; shrinks the space first |
-| Vector search (HNSW) | 5–20 ms | approximate-NN over a filtered subset |
-| FTS5 | < 10 ms | already fast today |
-| Graph traversal | 5–20 ms | 1–2 hops on an indexed adjacency |
-| RRF fuse | < 5 ms | pure arithmetic |
-| Rerank | 0–150 ms | optional; skip or small model for voice |
-| Context expand | < 20 ms | a few keyed DB reads |
-| **Synthesis first token** | 200–400 ms | streaming |
-| **Total to first token** | **~400–800 ms** | fan-out stages run in parallel |
-
-The retrievers run **concurrently**, so their wall-clock is the slowest one
-(~20 ms), not the sum. The two LLM calls (plan + synth) dominate — which is why
-model speed is the lever.
-
-## The seven speed principles
-
-1. **Precompute everything expensive.** Distillation, embedding, entity/graph
- extraction all happen on ingest, in the background. Query time never embeds a
- document or calls an LLM to summarize a source.
-2. **Prefilter before similarity.** Metadata filters (participant/place/time) cut
- the vector search space by orders of magnitude. Searching 300 candidates is
- both faster and more accurate than searching 3 million.
-3. **ANN index, not brute force.** HNSW (in sqlite-vec / pgvector) gives
- sub-20 ms nearest-neighbour at personal scale and stays sub-100 ms at millions
- of units.
-4. **Parallel fan-out.** The four retrievers are independent — fire them at once.
-5. **Small models on the hot path, big models off it.** Use a fast planner and a
- fast/streaming synthesizer for voice. Reserve larger models for background
- distillation where latency doesn't matter.
-6. **Stream the answer.** For voice, first-token latency is what the user feels.
- Start speaking as soon as synthesis emits.
-7. **Cache.** Cache resolved entities, hot query plans, and recent answers. Repeat
- and follow-up questions ("and where exactly?") reuse the retrieved evidence.
-
-## Two-tier retrieval for voice
-
-- **Fast tier (default for voice):** prefilter → vector + FTS + graph → RRF →
- **skip rerank** → synth. ~400–600 ms first token.
-- **Deep tier (UI / hard questions):** add HyDE, wider retrieval, cross-encoder
- rerank, more context expansion. ~1–2 s, higher precision.
-
-The planner picks the tier from the question (a crisp entity+place+time question
-→ fast tier; an open "tell me everything about my SF trips" → deep tier).
-
-## Scale notes
-
-- **Personal (one user):** sqlite-vec + HNSW handles millions of units on a
- laptop. This is the default and it is enough essentially forever for one person.
-- **Cloud / team:** pgvector with an HNSW index, same query shape. Cerebras runs
- 15k queries/day on a single Postgres embeddings table — the shape scales.
-
-## Speed is an architecture enabler (the Cerebras thesis)
-
-Fast inference doesn't just make the same pipeline quicker — it makes a **richer**
-pipeline affordable. Because plan/distill/rerank/synth are cheap, you can run all
-of them and still be realtime. On a slow model you'd have to drop steps and lose
-accuracy. This is the direct argument for pairing UltraWiki with the realtime
-model tier.
diff --git a/UltraWiki/06-deployment-local-cloud.md b/UltraWiki/06-deployment-local-cloud.md
deleted file mode 100644
index e78e026f83..0000000000
--- a/UltraWiki/06-deployment-local-cloud.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# 06 · Deployment — local *and* cloud, every layer
-
-Hard requirement (from the maintainer and from AP-22/23): the whole thing runs
-**fully local** on a normal machine and a headless Linux box, and **scales to
-cloud** when wanted — provider-agnostic, key-aware, degrading honestly. Nothing is
-load-bearing on a single vendor.
-
-## The matrix — each layer has both a local and a cloud path
-
-| Layer | Local (private · free · default) | Cloud (stronger · costs) | Degrades to |
-|---|---|---|---|
-| **Embeddings** | Ollama model (nomic-embed, bge, gte) — offline, nothing leaves the box | OpenAI, Gemini, Voyage, Cohere embeddings | **Normal Wiki** (FTS5 only), stated honestly |
-| **Vector store** | sqlite-vec on `data/jarvis.db` — no server, headless-ok | Postgres + pgvector | local is enough for one user ~forever |
-| **Entity/temporal graph** | tables in the same SQLite DB (or embedded Neo4j/Kùzu) | Neo4j / managed Graphiti | metadata-only retrieval (no multi-hop) |
-| **Reranker** | small local cross-encoder, or none | Cohere Rerank / LLM-rerank | RRF without rerank |
-| **Synthesis brain** | local LLM via Ollama | existing `provider_chain` (OpenRouter, Gemini…) | raw ranked evidence, no prose |
-| **VisionRAG** | local ColQwen2 (opt-in extra) | hosted vision model | text-only retrieval |
-
-Everything routes through **one key-aware chain** (the pattern
-`provider_chain.py` already implements): try the configured provider, else any
-other credential-ready provider, else degrade. New providers auto-join; no
-allowlist. Gate on **capability** ("can embed", "can rerank"), never a provider
-name (AP-21).
-
-## Privacy posture (matches Jarvis's "STT local, brain cloud" hybrid)
-
-"Pull everything in" means Slack/WhatsApp/mail/docs live — **distilled and
-embedded** — in the local DB. Two honest options, user's choice:
-
-- **Local embeddings (recommended default):** the distilled text is embedded on
- the user's own machine; **nothing leaves the box**. Best privacy, slightly lower
- retrieval quality, zero cost.
-- **Cloud embeddings (opt-in):** the *distilled* text (not raw messages) is sent
- to an embedding API. Better quality, a per-token cost, and a deliberate privacy
- trade the user opts into per source.
-
-Raw messages are never stored (only `raw_ref`), so even the local DB holds
-summaries + vectors, not full transcripts.
-
-## Headless / VPS
-
-Base install must boot on `python:3.11-slim` with no GPU, keyring, or audio:
-- sqlite-vec is pure SQLite — works.
-- Local embeddings need a model; on a tiny VPS, either use a small CPU embedding
- model or configure a cloud embedding key. If neither is present, UltraWiki
- **cleanly reports "not configured" and Normal Wiki keeps working** — never a
- crash, never a silent brick.
-
-## Cost shape
-
-- **One-time backfill:** embedding the historical import. Bounded, rate-limited,
- runs in the background. Local model = free (just time); cloud = a one-off token
- bill proportional to history size.
-- **Ongoing:** only deltas are embedded — cheap. A few distillation + embedding
- calls per new thread/doc.
-- **Query:** two small LLM calls (plan + synth) + index lookups. Negligible.
-
-The zero-cost, zero-key configuration (local everything) is a first-class,
-fully-supported path — not a degraded afterthought.
diff --git a/UltraWiki/07-reuse-map-and-gaps.md b/UltraWiki/07-reuse-map-and-gaps.md
deleted file mode 100644
index 827e400664..0000000000
--- a/UltraWiki/07-reuse-map-and-gaps.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# 07 · Reuse Map & Gaps — what exists vs what's new
-
-The honest scope. Jarvis already ships roughly two-thirds of this system. The
-genuinely new work centers on **one keystone (embeddings + vector index)** and its
-downstream wiring. This doc names the existing modules a coding agent should build
-on, so nothing is rebuilt from scratch.
-
-## Already in Jarvis — reuse it **[HAVE]**
-
-| Capability | Where | Use for |
-|---|---|---|
-| Two-stage distill pipeline | `jarvis/memory/wiki/extractor.py`, `consolidator.py`, `curator.py` | L2 distill + consolidate — add an embed step at the end |
-| Atomic writes (lock+tempfile+BOM) | `wiki/atomic_writer.py`, `core/config_writer.py` | safe upserts (AP-7) |
-| FTS5 keyword index | `wiki/fts_index.py`, `search.py`, migration `0004_wiki_fts.sql` | the keyword half of hybrid search |
-| Key-aware provider fallback | `wiki/provider_chain.py` | plan + synth LLM calls, embedding-provider chain |
-| Live filesystem sync | `wiki/watcher.py` (+ `wiki_ws.py`) | Obsidian connector; live UI updates |
-| Contacts / person-pages | `wiki/contact_mirror.py`, `memory/people.py` | entity resolution + graph nodes |
-| Candidate journal / audit | `wiki/journal.py`, extraction-audit tables | ingest provenance |
-| OAuth + connectors | `jarvis/marketplace/` (registry, token_store, oauth_*, discord/telegram connect, Drive/Calendar/Slack/Notion cards) | L1 connectors — most of the auth is done |
-| Channel bots | `jarvis/channels/{discord,telegram}.py` | realtime push connectors |
-| External data tools | `plugins/tool/drive_rest.py`, `google_calendar_rest.py` | Drive/Calendar fetch |
-| Wiki frontend + graph | `frontend/src/components/wiki/` (`WikiGraph.tsx`, search, renderer), `wiki_routes.py` | the UI to extend into the brain view |
-| Episodic memory | `jarvis/awareness/` | complementary time-ordered signal |
-| EventBus | `core/bus.py` | ingest queue / event fan-out |
-
-## Genuinely new — build it **[NEW]**
-
-| Piece | Effort | Notes |
-|---|---|---|
-| **Embedding layer** | **keystone** | capability-gated provider (local Ollama / cloud API) through a key-aware chain; the one thing everything else depends on |
-| **Vector index** | small | sqlite-vec on the existing `jarvis.db` (+ pgvector driver for cloud) |
-| **Entity/temporal graph** | medium | `entity` + `edge` tables, bi-temporal fields, write-time extraction; or embed Graphiti |
-| **Hybrid fusion + rerank** | small–medium | RRF over FTS+vector+graph, optional cross-encoder rerank |
-| **Query planner** | small | one LLM call → structured facets (+ entity resolution on read) |
-| **RAG synthesizer** | small | evidence → cited answer via `provider_chain` (reuse) |
-| **Connector "source" interface** | medium | the plugin contract: *what / how to connect / how to sync*; wrap existing OAuth + add cursor/backfill |
-| **New connectors** | per-source | Slack (socket), WhatsApp, GitHub, mail — reuse marketplace auth |
-| **Brain UI** | medium | "Ask your brain" search + the graph over all sources + connector dashboard |
-| **VisionRAG** | later/opt-in | ColPali multi-vector for images/PDFs |
-
-## Extend (exists, needs a bit) **[EXTEND]**
-
-- `consolidator.py` → also do bi-temporal INVALIDATE on the graph.
-- `contact_mirror.py` → also emit graph nodes/edges, not just pages.
-- Drive/Calendar tools → add cursor-based incremental sync + backfill.
-- `WikiGraph.tsx` → render all-source nodes + semantic neighbourhood, not just
- wikilinks.
-
-## One-line scope summary
-
-> Build the **embedding + vector + graph** core, wrap the **existing OAuth/distill/
-> FTS/provider-chain** machinery around it, and add the **planner + fusion +
-> synthesizer** on top. ~1/3 new, ~2/3 wiring.
diff --git a/UltraWiki/08-roadmap-and-open-questions.md b/UltraWiki/08-roadmap-and-open-questions.md
deleted file mode 100644
index 8ed9e6aecf..0000000000
--- a/UltraWiki/08-roadmap-and-open-questions.md
+++ /dev/null
@@ -1,96 +0,0 @@
-# 08 · Roadmap & Open Questions
-
-## Build order — each phase is usable on its own
-
-No big-bang. Every phase ships something the user can feel, and the first one
-needs **no external connector at all**.
-
-### Phase 0 — Semantics on what's already there
-- Add the **embedding layer** + **vector index** (sqlite-vec) on the existing
- distilled wiki pages.
-- Add **hybrid search** (FTS5 + vector + RRF) to `wiki/search.py`.
-- **Win:** search in today's wiki gets noticeably better. Zero new connectors,
- lowest risk, proves the keystone.
-- Touches: `provider_chain`, `search.py`, `fts_index.py`, a new `vector_index`,
- an embed step in `curator.py`.
-
-### Phase 1 — First external connector + the source interface
-- Define the **`source` plugin contract** (what / how to connect / how to sync).
-- Wire **Google Drive** through it (the tool already exists) with cursor sync +
- a bounded backfill.
-- **Win:** first real outside knowledge in the brain; the connector pattern is
- proven end-to-end.
-
-### Phase 2 — Entity/temporal graph + realtime sources
-- Add `entity` + `edge` tables, **bi-temporal** fields, write-time entity/relation
- extraction; hook it to contacts.
-- Add **realtime** connectors: Slack (Socket Mode), Telegram/Discord (channels
- exist), incremental only.
-- **Win:** "who/when/where" questions work; "always up to date" becomes real.
- This is the phase that makes the **Viktoria query** answerable.
-
-### Phase 3 — Full RAG read path + Brain UI
-- **Planner → fan-out → RRF → rerank → context expand → synthesize** with
- citations; two-tier (fast for voice / deep for UI).
-- Frontend: **"Ask your brain"** search, the **all-source graph**, a **connector
- dashboard** with sync status.
-- **Win:** the second brain talks back, in voice and UI, with sources.
-
-### Phase 4 — Scale & platform
-- Optional **pgvector** backend for team/cloud.
-- **MCP retrieval primitives** (`search_unified`, `graph_lookup`, `who_knows`,
- `timeline`) with no synthesis LLM — Jarvis's memory becomes a source other
- agents (and Jarvis's own workers) can query.
-- Optional **VisionRAG** (ColPali) for images/PDFs.
-- **Win:** scales past one machine; the brain becomes a platform.
-
-## Rough dependency graph
-
-```
-Phase 0 (embeddings+vector) ─┬─► Phase 1 (connector interface)
- └─► Phase 2 (graph + realtime) ─► Phase 3 (RAG + UI) ─► Phase 4 (scale/MCP/vision)
-```
-
-Phase 0 unblocks everything. Phases 1 and 2 can proceed in parallel once 0 lands.
-
----
-
-## Open questions — only the maintainer can answer
-
-1. **Audience: single-user or teams/cloud too?**
- - Impact: whether to design the pgvector/permission path from the start or
- defer it. *Recommendation:* **local-first, cloud as an open option** — matches
- the privacy-hybrid posture; pgvector is a swap-in, not a rewrite.
-
-2. **Privacy: local or cloud embeddings by default?**
- - Impact: does distilled text ever leave the machine. *Recommendation:*
- **local embeddings default, cloud opt-in per source.** Nothing leaves the box
- unless the user says so.
-
-3. **Where to start: Phase 0 or a flashy connector first?**
- - Impact: fastest visible win vs fastest "wow". *Recommendation:* **Phase 0** —
- lowest risk, improves what exists immediately, and de-risks the keystone
- before any connector work.
-
-4. **How much history to backfill on connect?**
- - All-time vs last N months. Affects one-time cost/time. *Recommendation:*
- a bounded default (e.g. 12 months) with an "import everything" opt-in.
-
-5. **Graph store: hand-rolled SQLite tables or embed Graphiti/Kùzu?**
- - Impact: build effort vs a dependency. *Recommendation:* start with **SQLite
- tables** (no new infra, headless-safe); revisit Graphiti if temporal logic
- gets heavy.
-
-6. **"Mantis" — did you mean a specific tool?**
- - Not found as a known RAG framework. Currently interpreted as the
- temporal/graph memory need (Graphiti/Zep). If a specific product was meant,
- name it and it gets slotted into doc 04.
-
----
-
-## Definition of done for the whole thing (the north-star test)
-
-Ask, by voice: **"When was I at dinner with Viktoria in San Francisco?"** →
-Jarvis returns the **exact date, venue, and sources** in **under ~1 second to
-first spoken word**, entirely from the user's own connected data, and does it on
-a machine with **only local models** as well as with cloud keys.
diff --git a/UltraWiki/09-decisions-and-handoff-integration.md b/UltraWiki/09-decisions-and-handoff-integration.md
deleted file mode 100644
index 40d8516481..0000000000
--- a/UltraWiki/09-decisions-and-handoff-integration.md
+++ /dev/null
@@ -1,279 +0,0 @@
-# 09 · Locked Decisions & Handoff Integration
-
-> This document merges an external architecture handoff (a second, independent
-> design session) into the UltraWiki design. **Where it sharpens or contradicts
-> docs 01–08, this document wins.** The two sessions converged on the same
-> north-star query independently — strong evidence the direction is right.
-
----
-
-## 0. Locked decisions (maintainer, 2026-07-23)
-
-These are settled. Do not revisit without refuting the rationale.
-
-### D-1 · Build inside Jarvis, in Python
-UltraWiki is a module of Personal Jarvis, not a separate product. Reuse what
-Jarvis already ships (~2/3): the distill pipeline (`extractor`/`consolidator`/
-`curator`), contacts/person-pages, the `marketplace/` OAuth machinery, the
-`provider_chain` key-aware fallback, FTS5, the wiki watcher. The external handoff
-assumed a JavaScript greenfield build — its **principles are language-neutral and
-adopted in full; its language/stack are not**. Every stack item below is mapped to
-a Python equivalent.
-
-### D-2 · Store access via connection string only — NO vector-DB SDK in code
-The store is a SQL database reached through a **connection string**. Vector search
-lives as a **database extension** (`pgvector` on Postgres, `sqlite-vec` on SQLite)
-queried through **plain SQL**. The code never imports a vector-DB client
-(`chromadb`, `faiss`, `pinecone-client`, `qdrant-client`, `weaviate-client`, …).
-
-Rationale: swappable (local SQLite ↔ cloud Postgres over the same SQL layer), no
-vendor lock-in, testable without a running vector service, headless-safe, and it
-matches AP-21 (gate on capability, not a product name). The DB access layer is a
-thin typed-SQL wrapper (`asyncpg` / SQLAlchemy Core / raw SQL) — a SQL toolkit,
-**not** a vector SDK.
-
-### D-3 · Primary store Postgres + pgvector; SQLite + sqlite-vec is the local floor
-Handoff Decision 1: one store holds vector, full-text, time-ranges, and graph in a
-single transaction, with sync-state next to the data. Postgres 16+ with `pgvector`
-+ `pg_trgm` is the primary. `sqlite-vec` on the existing `data/jarvis.db` is the
-zero-server local/headless floor. Both are addressed via D-2 (connection string +
-SQL). **Open point (O-1):** running Postgres on a plain desktop / headless box
-(embedded Postgres vs. requiring a server vs. defaulting to the SQLite floor).
-
----
-
-## 1. The four reframes (adopted from the handoff — the load-bearing ideas)
-
-### R-1 · It's a reconstruction problem, not a retrieval problem
-The sentence the search should find often **does not exist** in the data: a chat
-reads "19:00?" — "works" — "omw", with no restaurant, no city, no date. No
-similarity search finds a sentence that was never written. The answer is
-**reconstructed** from several independent sources — chat + photo EXIF/GPS +
-calendar + card statement + location history. The **structured event/entity layer
-carries the load; vector search is the fallback, not the main path.** This
-sharpens doc 03/04: retrieval is *triangulation across sources*, not top-k
-similarity.
-
-### R-2 · History and flow are two separate systems
-A one-time 10-year backfill and the last-minute inflow have completely different
-needs (rate limits, legality, fault tolerance, mode). One mechanism for both is
-the classic mis-build.
-- **History comes from official data exports** — GDPR Art. 20 forces any
- EU-operating service to hand data over machine-readably. WhatsApp "Export chat",
- Google Takeout, Instagram, Apple, Amazon, Netflix, Spotify. Legal, complete, no
- rate limit, no ban risk. **This is how we get WhatsApp** — not a realtime
- connector.
-- **Flow comes from APIs, webhooks, and local file watchers.**
-This replaces doc 02's single "backfill trigger" with two distinct paths.
-
-### R-3 · Realtime is created on write, not on read
-Already in our docs (doc 05). Kept as a first-class principle: the write path is
-expensive, async, and does all the work up front; the read path only looks things
-up. The only route to sub-second.
-
-### R-4 · State belongs in the database, not the call stack
-Not `fetch() → normalize() → embed() → store()`. If step 3 fails, 1 and 2 are
-lost; a restart redoes everything; one bad item blocks the queue. Instead **each
-item carries its state as a column**; workers perform exactly one transition and
-commit. Failures are local, retryable, and block nothing. This is a hard upgrade
-over doc 02's "durable queue" — it becomes an explicit state machine.
-
----
-
-## 2. Decision log (adopted, adapted to Python/Jarvis)
-
-| # | Decision | Why | Rejected |
-|---|---|---|---|
-| 1 | Postgres as the single store (SQLite floor) | vector+FTS+time+graph in one transaction; sync-state with data | separate vector DB → consistency hell |
-| 2 | Structured extraction before embedding | R-1 | pure vector RAG |
-| 3 | Exports for backfill, APIs for flow | R-2 | one mechanism for both |
-| 4 | Unofficial clients (Baileys etc.) NOT in core repo | shipping them distributes a ToS breach + account-ban risk (pattern: yt-dlp, HACS) | Baileys in main repo |
-| 5 | A connector yields only `RawItem`, never touches the DB | 3rd-party community code must not reach the user's data | connector writes itself |
-| 6 | `AsyncIterator`, not a returned list | 10-year backfills are six-figure; streaming lets the runtime own memory + checkpoints | return an array |
-| 7 | No enrichment in the connector | pure I/O is testable without models, cost, or network | connector embeds itself |
-| 8 | A `capabilities` declaration drives the scheduler | connector authors don't write scheduling logic | each connector polls itself |
-| 9 | State machine with state in the DB | R-4 | function chain |
-| 10 | Extraction cached on `(content_hash, prompt_version, model)` | LLM output isn't deterministic even at temp 0; identical input is never re-called, so the *system* is reproducible | call every time |
-| 11 | Versioned enrichment, not rebuild | the extraction prompt will change; a full re-import on a local system is unacceptable | throw DB away, re-import |
-| 12 | Push for latency, poll for correctness | webhooks arrive twice / never / out of order; a desktop app has no public endpoint anyway | webhooks only |
-| 13 | Bitemporality on facts | else "where does X live" can't be told from "where did X live in 2018" | one timestamp |
-| 14 | Confirmation queue, not auto-merge below a confidence threshold | Trap 1 | always auto-merge |
-| 15 | Multilingual embeddings (`bge-m3` class) | the data is largely German; English-tuned models measurably degrade there | default English model |
-| 16 | Four complementary indexes, fused by RRF | each covers where the others fail | vector only |
-| 17 | `permalink` mandatory on every item | without it the system knows *when* but not *where to* — half the requirement | store content only |
-
----
-
-## 3. What kills this project (traps, by damage)
-
-1. **Wrong identity merge** — two people fused into one entity; every answer about
- both is now wrong, noticed months later. *Fix:* deterministic resolution first;
- uncertain cases into a **confirmation queue**, not an auto-merge; merges logged
- reversibly. **This is the #1 killer.**
-2. **Function chain instead of state machine** (R-4) — unrepairable without a
- rebuild. *Fix:* get Phase 1 right before anything else exists.
-3. **Missing idempotency** — reruns after crashes/deploys must converge. *Fix:*
- `UNIQUE (source, external_id)`, every write an UPSERT, every transition
- individually retryable.
-4. **Relative time stored as string** — "next Friday" left as text is never
- filterable again; episodic ability collapses. *Fix:* resolve against the
- message's own timestamp, store as an absolute time range.
-5. **Vector search as the main path** — works in a 10-doc demo, fails the litmus
- test. *Fix:* extraction layer first, embeddings as a supplement.
-6. **Missing `permalink`** — surfaces only when the corpus is big; retrofitting
- means a full re-import. *Fix:* mandatory from item one.
-7. **Unofficial clients in core** — users lose accounts, it reflects on the
- project. *Fix:* a separate community repo with an install-time warning.
-8. **No eval set** — can't tell if a change improved or regressed anything. *Fix:*
- Phase 6.
-9. **Migrations on distributed local DBs** — not one server DB but thousands of
- local DBs in different states. *Fix:* forward-only, each migration tested
- against a fixture DB of the previous version.
-10. **Webhooks as the only truth** — gaps go unnoticed until an answer is wrong.
- *Fix:* a nightly reconcile run per connector.
-11. **Forgotten deletions** — user deletes a message, the system keeps answering
- with it. *Fix:* tombstones, detection in the reconcile run, cascading delete
- onto everything derived.
-
----
-
-## 4. Phases & gates (the real discipline is the gates)
-
-The gate — what must be *true* before the next phase begins — matters more than
-the phase. Note this **reorders** doc 08: **runtime-first**, indexes late.
-
-- **P1 · Runtime.** `RawItem` schema; state machine (`raw → normalized → resolved
- → extracted → indexed`, plus `retrying`/`failed`); worker loop with retry,
- backoff, dead-letter. **Gate:** four scenarios green as automated tests —
- (a) a 1000+-item backfill hard-killed mid-run restarts to an identical end state
- (no dupes, no gaps); (b) a connector throwing at item 500 lets 1–499 finish and
- 500 land in `failed`; (c) a second run over unchanged data creates zero new
- enrichment jobs (proof via `content_hash`); (d) the whole suite runs with no
- network and no credentials.
-- **P2 · First connector + fixture CI.** Exactly one Class-D connector (local
- file, no OAuth, no network) + the fixture test harness. **Gate:** a stranger can
- write and CI-test a connector with no network/credentials/DB. If the contract
- feels awkward here, fix the contract before P3.
-- **P3 · Identity resolution.** `entities` + `identifiers`, deterministic
- resolution, contact-book match, fuzzy resolution (name similarity + co-occurrence),
- confirmation queue. **Gate:** a golden set of 30–50 known people resolves
- correctly; **zero wrong merges**; uncertain cases provably queue.
-- **P4 · Episodic layer.** Session segmentation, burst detection, LLM event
- extraction, temporal anchoring of relative expressions, bitemporality. **Gate:**
- the litmus test is answered correctly on a real data slice — with date,
- confidence, and `permalink` to the evidence. **This is where the project proves
- it works; before this it's all infrastructure.**
-- **P5 · Indexes & query path.** Four indexes, slot extraction, routing, parallel
- fan-out, RRF fusion, rerank, cross-source triangulation, cited synthesis.
- **Gate:** latency *measured*, not estimated — under 1 s to first token on a
- multi-hop question over a realistically large corpus.
-- **P6 · Eval as a CI gate.** 100–200 real questions with known answers.
- Retrieval-recall measured **separately** from answer accuracy. **Gate:** a
- regression breaks the build. Only from here is prompt-tuning worthwhile.
-- **P7 · Connector scaling.** Only now the 2nd, 3rd, 10th connector. Built earlier,
- the runtime gets rewritten repeatedly.
-
----
-
-## 5. Technical reference (adapted to Python)
-
-### 5.1 `items`
-`source`, `external_id`, `thread_id`, `author_identifier` (raw, unresolved),
-`timestamp_utc`, `body`, `attachments`, `permalink`, `content_hash`, `status`,
-`attempt_count`, `last_error`, `next_retry_at`, `deleted_at`.
-`UNIQUE (source, external_id)`.
-
-### 5.2 `entities` / `identifiers`
-`entities`: person, place, org, project. `identifiers`: many-to-one on `entities`
-— one person typically has 5–10 identifiers (phone, several emails, handles,
-display names, nicknames). Reuse Jarvis contacts as the seed.
-
-### 5.3 `events`
-`event_type` (`meal`/`travel`/`meeting`/`purchase`/`milestone`), `participants`
-(entity ids), `place_id`, `valid_time` (time range), `confidence`, `evidence`
-(item ids), `extraction_version`.
-
-### 5.4 Connector contract (Python)
-A connector is a `Protocol` yielding only `RawItem`; it never touches the DB, does
-no enrichment, and declares capabilities that drive the scheduler:
-- `id: str`; `auth: oauth2 | apikey | local-file | export-upload | none`
-- `capabilities`: `backfill: bool`, `incremental: push | cursor | full-scan | none`,
- `deletes: bool`
-- `backfill(ctx, checkpoint=None) -> AsyncIterator[RawItem]`
-- `incremental(ctx, cursor) -> AsyncIterator[RawItem]`
-
-### 5.5 Procurement classes
-| Class | Examples | Backfill | Flow | Risk |
-|---|---|---|---|---|
-| A — API + push | Gmail, GCal, GitHub, Notion, Slack, Linear | API | webhook | none |
-| B — API, poll only | smaller services | API | cursor-poll | none |
-| C — Export | WhatsApp, Instagram, Apple, Amazon, Netflix | file import | ✗ | none |
-| D — Local artifacts | iMessage `chat.db`, Apple Notes, Photos, browser history, Obsidian, filesystem | read file | file watcher | none |
-| E — Unofficial | Baileys, scrapers | yes | yes | ToS breach, account ban |
-**Class D is the underrated foundation** — no OAuth, no network, no credentials,
-no legal question, instantly testable, and identical to the local-first claim.
-**Start P2 with a Class-D connector.**
-
-### 5.6 Backfill mechanics
-Split into monthly windows, descending. Each completed window persists a
-checkpoint; an abort resumes at the last complete window. `sync_state` per (user,
-connector): `cursor`, `last_success_at`, `backfill_position`, `backfill_complete_at`.
-
-### 5.7 Indexes
-| Index | Technique | Covers |
-|---|---|---|
-| Vector | `pgvector` HNSW over session summaries + bursts | paraphrase |
-| Full-text | Postgres `tsvector` + GIN (or ParadeDB BM25); SQLite FTS5 on the floor | exact strings, names, errors |
-| Time | GiST over a time range | everything episodic |
-| Graph | edge table person↔person, person↔place, person↔topic | multi-hop |
-Plus a per-person entity profile, re-summarized on change, so "who is X" is a
-lookup, not a scan.
-
-### 5.8 Stack (Python mapping — all store access via D-2)
-Postgres 16+ (`pgvector` + `pg_trgm`), SQLite + `sqlite-vec` floor · thin typed
-SQL (`asyncpg` / SQLAlchemy Core / raw SQL — **no vector SDK**) · a DB-backed job
-queue (state-in-DB, no Redis) · `aioimaplib` IMAP IDLE for mail · Google Calendar
-push · `piexif`/`Pillow`/`exifread` for photo metadata · `bge-m3` (multilingual)
-locally via `sentence-transformers` or Ollama · `dateparser` + LLM fallback for
-time expressions · a rerank capability (Voyage `rerank-2` or a local cross-encoder)
-· `provider_chain` (any fast provider) for planner + synthesis.
-
-### 5.9 Latency budget
-Ingest: raw item full-text-findable in < 2 s, embedding async after, LLM
-extraction within minutes. Query: planner 100–200 ms, parallel retrieval
-50–150 ms, rerank 100 ms, synthesis streamed. Under 1 s to first token.
-
----
-
-## 6. Open points (decide before the relevant phase)
-- **O-1 · Postgres on a local/headless box** (D-3) — embedded Postgres vs. require
- a server vs. default to the SQLite floor. Affects P1/P7.
-- **O-2 · Webhook endpoint for a local desktop install** — relay service
- (centralized, weakens privacy) vs. pure polling. Affects P7.
-- **O-3 · Extraction model local or external** — external is faster/better but raw
- content leaves the device; with this corpus that's a matter of principle.
- Affects P4. (Ties to Jarvis's privacy-hybrid stance.)
-- **O-4 · Cost of the first import** — LLM extraction over 10 years of chat is the
- single biggest line item; tiered model choice by information density is an option.
-- **O-5 · Per-service export parsers** — every provider has its own format that
- changes; needs the same fixture approach as API connectors.
-- **O-6 · Encryption at rest + key management** — the most sensitive corpus a user
- will ever hold in one place.
-
----
-
-## 7. How this reshapes docs 01–08
-
-| Earlier doc | Sharpened / overridden by |
-|---|---|
-| 02 ingestion | R-2 (history=exports vs flow=APIs), R-4 (state machine), traps 3/9/10/11, procurement classes A–E |
-| 03 retrieval | R-1 (reconstruction/triangulation), slot extraction, cross-source confirm |
-| 04 accuracy | trap 1 (wrong merge → confirmation queue), D-15 (multilingual embeddings), bitemporality as facts |
-| 05 performance | R-3 confirmed; latency budget kept |
-| 06 deployment | D-2 (connection-string-only, no vector SDK), D-3 (Postgres primary / SQLite floor) |
-| 07 reuse map | D-1 reaffirms Python/Jarvis reuse; the new-vs-have split stands |
-| 08 roadmap | replaced by §4 here — runtime-first, hard gates, indexes late, eval as a gate |
-
-**Bottom line:** the handoff's principles are adopted wholesale; they are built in
-Python inside Jarvis, over a connection-string SQL store with no vector SDK, with
-runtime + identity + episodic layers proven (gated) before indexes and scale.
diff --git a/UltraWiki/README.md b/UltraWiki/README.md
deleted file mode 100644
index 1d60a56c6f..0000000000
--- a/UltraWiki/README.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# UltraWiki — the Personal Brain
-
-> **Status: design & idea collection. No implementation yet.** This folder is the
-> spec that coding agents will later build from. All artifacts here are English
-> per the repo language rule; conversation about them happens in the maintainer's
-> language.
-
-UltraWiki turns Jarvis's existing wiki from a local keyword-searched Obsidian
-vault into a **semantic personal memory** that ingests everything the user
-already produces — Slack, WhatsApp, GitHub, Google Drive, Calendar, Notion,
-e-mail, the Obsidian vault itself — and answers questions about the user's own
-life **fast enough for the realtime voice model** and **accurate enough to name
-the exact date, place, and people** behind a vague question.
-
-The north-star query, used as the worked example throughout these docs:
-
-> **"When was I at dinner with Viktoria in San Francisco?"**
->
-> → *"On 23 June 2024, at Trestle in San Francisco. Sources: WhatsApp thread
-> (23 Jun), calendar event 'Dinner w/ Viktoria'."*
-
-Answering that well is the whole design problem. It needs **entities** (who is
-Viktoria), **places** (San Francisco), **time** (a specific date is the answer),
-**activity semantics** (dinner ≈ essen ≈ restaurant), and it must read the *right*
-chat thread out of years of history in a few hundred milliseconds.
-
-> **Locked decisions (2026-07-23) — see [`09-decisions-and-handoff-integration.md`](09-decisions-and-handoff-integration.md):**
-> **(D-1)** built inside Jarvis, in Python, reusing the existing ~2/3.
-> **(D-2)** store access via **connection string only — no vector-DB SDK in code**;
-> vector search is a DB extension (`pgvector`/`sqlite-vec`) queried through SQL.
-> **(D-3)** Postgres + pgvector primary, SQLite + sqlite-vec local floor.
-> Doc 09 merges an external architecture handoff and, where it sharpens docs 01–08,
-> **it wins**.
-
----
-
-## The two modes (like Realtime vs Pipeline for the API keys)
-
-| | **Normal Wiki** (ships today) | **Ultra Wiki** (this design) |
-|---|---|---|
-| Store | Obsidian markdown + SQLite FTS5 | + vector index + entity/temporal graph |
-| Search | keyword (BM25) | hybrid: keyword + vector + graph + time |
-| Sources | Jarvis conversations | + every connected external source |
-| Answers | page links | cited RAG answers with exact facts |
-| Needs | nothing (offline, free) | 1 embedding provider (local or cloud) |
-| Fallback | — | degrades cleanly back to Normal Wiki |
-
-Ultra is an **add-on, not a replacement**. If the embedding provider is missing,
-Ultra falls back to Normal Wiki and says so. This mirrors the AP-22/AP-23 mandate:
-provider-agnostic, key-aware, degrades honestly, runs on a headless Linux box.
-
----
-
-## The two paths (the whole system in one sentence each)
-
-- **Write path (background, always-on):** a source changes → Jarvis fetches the
- delta → an LLM **distills** it into a clean document → **extracts entities,
- relations, and timestamps** → **embeds** it → **upserts** one row into the
- unified store and edges into the graph. Incremental, idempotent, never
- re-scans everything. → [`02-ingestion-write-path.md`](02-ingestion-write-path.md)
-
-- **Read path (live, must be fast):** a question arrives → an LLM **plans** it
- into `{entities, place, time-window, semantic core, sources}` → resolves
- "Viktoria" to a real contact → **fans out in parallel** over vector + keyword +
- graph + time → **fuses** (RRF) → **reranks** → **expands context** →
- **synthesizes** a cited answer. → [`03-retrieval-read-path.md`](03-retrieval-read-path.md)
-
----
-
-## Document index
-
-| File | What it covers |
-|---|---|
-| [`01-architecture.md`](01-architecture.md) | The 5 layers, the unified store schema, the entity/temporal graph |
-| [`02-ingestion-write-path.md`](02-ingestion-write-path.md) | Connectors, how "always latest" works (webhook / socket / poll / CDC), distill → extract → embed → upsert |
-| [`03-retrieval-read-path.md`](03-retrieval-read-path.md) | Query understanding → fan-out → fuse → rerank → synthesize, with the Viktoria query traced end-to-end |
-| [`04-accuracy-techniques.md`](04-accuracy-techniques.md) | Every trick for "extremely accurate on vague questions": contextual retrieval, GraphRAG, bi-temporal, entity resolution, HyDE, reranking, VisionRAG |
-| [`05-performance-realtime.md`](05-performance-realtime.md) | The latency budget, ANN/HNSW, prefilter-first, precompute, streaming — how it stays realtime-fast |
-| [`06-deployment-local-cloud.md`](06-deployment-local-cloud.md) | Local vs cloud for every layer, privacy, graceful degradation |
-| [`07-reuse-map-and-gaps.md`](07-reuse-map-and-gaps.md) | What Jarvis already has vs what is genuinely new (the ~1/3 to build) |
-| [`08-roadmap-and-open-questions.md`](08-roadmap-and-open-questions.md) | Phased build order + the decisions only the maintainer can make |
-| [`09-decisions-and-handoff-integration.md`](09-decisions-and-handoff-integration.md) | **Authoritative.** Locked decisions, the external handoff merged in, decision log, kill-list, phase gates, Python-adapted tech reference |
-
----
-
-## How to use this with coding agents later
-
-Each doc is written so a coding agent can take one phase from
-[`08-roadmap-and-open-questions.md`](08-roadmap-and-open-questions.md), read the
-relevant design doc, and implement it against the existing Jarvis modules named
-in [`07-reuse-map-and-gaps.md`](07-reuse-map-and-gaps.md). The design deliberately
-reuses Jarvis's `curator`/`extractor`/`consolidator` distill pipeline, the
-`provider_chain` key-aware fallback, the FTS5 index, the wiki watcher, the
-`marketplace/` OAuth machinery, and the `contacts` store — so most of the work is
-wiring, not greenfield.
-
-## Prior art these docs lean on
-
-- **Cerebras Knowledge** — the "meet the data where it lives / one embeddings
- table / distill before embed / hybrid search / speed enables architecture"
- doctrine.
-- **Anthropic Contextual Retrieval** — prepend context to each chunk before
- embedding; hybrid + RRF + rerank (−67% failed retrievals).
-- **Graphiti / Zep** — bi-temporal knowledge graph for agent memory (valid-time
- vs ingestion-time, invalidate-don't-delete). This is the backbone of temporal
- accuracy.
-- **ColPali / ColQwen2** — vision-based document retrieval (late interaction) for
- screenshots, photos, and visually-rich PDFs, no OCR.