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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
docs(ultrawiki): from-scratch design — two-mode wiki, BYO providers, voice day-1
Ruben Lütkee71fce64b241
diff --git a/UltraWiki/01-architecture.md b/UltraWiki/01-architecture.mdnew file mode 100644index 0000000000..571b9d1bbc--- /dev/null+++ b/UltraWiki/01-architecture.md@@ -0,0 +1,120 @@+# 01 · Architecture++## Principles (each one is load-bearing)++1. **Meet data where it lives.** No source is forced into a new home. One+ connector per source extracts data directly from where the user already+ produces it; the platforms stay the system of record for editing.+2. **One unified store.** Every source — a WhatsApp export line, an Obsidian+ note, a calendar event, a plugin's output — lands as rows of the same shape+ in one database. Anything in the store is immediately queryable through the+ same interface; adding a source never changes the query side.+3. **Distill before you embed.** Raw content is kept and keyword-indexed as-is,+ but what gets embedded is a normalized document an LLM distilled from it+ (question, summary, resolution, entities, references). Cerebras measured a+ significant accuracy gain from this normalization; raw transcripts embed+ poorly because chat is fragmentary and length-biased.+4. **Do the expensive work on write, never on read.** Ingestion may take+ seconds per item and run for hours in the background; the query path only+ looks things up. This is the only route to the day-one voice budget (D-8).+5. **Hybrid retrieval, no single scorer trusted.** Keyword search catches exact+ tokens (names, error strings), vector search catches paraphrase, term-rarity+ weighting separates signal from filler, recency decay retires stale answers,+ and the entity/time indexes answer "who/when" directly. Their ranked lists+ are fused; no technique is allowed to veto the others.+6. **Bring-your-own everything, degrade honestly (D-2).** No bundled services.+ Every capability slot (storage, embedding, distillation) offers at least one+ local and one cloud option, chosen by the user. A missing or dead choice+ produces an honest message and a graceful fallback, never a brick — on+ Windows, macOS, Linux, and a headless server alike.++## Layer model++```+┌────────────────────────────────────────────────────────────────────┐+│ SURFACES Wiki UI (Ultra mode) · chat · realtime voice · │+│ REST routes → jarvis CLI · brain tools for agents │+├────────────────────────────────────────────────────────────────────┤+│ READ PATH planner → parallel fan-out over indexes → RRF fusion │+│ → rerank → context expansion → cited synthesis │+├────────────────────────────────────────────────────────────────────┤+│ UNIFIED STORE items · documents+embeddings · entities · │+│ identifiers · events · areas · sync/queue state │+├────────────────────────────────────────────────────────────────────┤+│ WRITE PATH staged pipeline (state machine in the DB): │+│ captured → keyword-indexed → embedded → distilled │+│ → entity-linked │+├────────────────────────────────────────────────────────────────────┤+│ CONNECTORS local files · export imports · OAuth APIs · │+│ Jarvis plugin/CLI bridge · community connectors │+└────────────────────────────────────────────────────────────────────┘+```++Higher layers reach lower ones only via the existing Jarvis protocol/event+conventions; the write path runs strictly off the voice hot path.++## Storage: two backends, one SQL surface++The store is an SQL database addressed through a **user-supplied location** —+a local file path or a connection string (D-2). Vector search is provided by a+database extension, queried through plain SQL; the code never imports a+vector-database SDK. This keeps the two backends behind one code path:++| | **Local option** | **Cloud / self-hosted option** |+|---|---|---|+| Engine | SQLite file under the Jarvis data dir | PostgreSQL via connection string (any host: own server, Supabase, Neon, RDS, …) |+| Vectors | `sqlite-vec` extension | `pgvector` extension |+| Keyword search | FTS5 | `tsvector` + GIN |+| Setup burden | zero — created on activation | user pastes a connection string in the settings section |+| Fits | single device, offline, default experience | multi-device access, large corpora, server installs |++Both run the identical schema and the identical query templates (a thin+dialect adapter covers the FTS and vector syntax differences). Migrations are+forward-only and tested against fixture databases of the previous version,+because thousands of independent local installs will be on different versions.++## Unified store schema (v1)++Column lists are indicative, not final DDL.++- **`uw_items`** — one row per raw unit (a message thread, a note, a calendar+ event, a mail, a file chunk, a plugin record):+ `id, source_id, external_id, area_ids, thread_key, author_raw, body_raw,+ attachments, permalink, timestamp_utc, content_hash, state, attempt_count,+ last_error, next_retry_at, deleted_at`.+ `UNIQUE (source_id, external_id)`; every write is an upsert (idempotent+ re-runs). `state` drives the staged pipeline (doc 02). **`permalink` is+ mandatory from item one** — an answer must always be able to deep-link back+ to where the evidence lives.+- **`uw_documents`** — the distilled, embed-ready documents derived from items+ (thread summary, burst, file chunk, event description):+ `id, item_id, doc_type, text_normalized, embedding, embed_model,+ distill_version, idf_score, created_at`.+ Several documents may derive from one item (whole-thread + notable bursts).+- **`uw_entities` / `uw_identifiers`** — people, places, organizations,+ projects; identifiers map raw handles (phone numbers, emails, nicknames,+ display names) many-to-one onto entities. Seeded from Jarvis contacts.+ Merge history is kept so any merge is reversible (D-10).+- **`uw_events`** — reconstructed episodic facts: `event_type (meal / travel /+ meeting / purchase / milestone), participant_entity_ids, place_entity_id,+ time_range, confidence, evidence_item_ids, extraction_version`. Time ranges+ are always absolute (relative expressions are resolved against the source+ item's own timestamp at extraction time — "next Friday" is never stored as+ text).+- **`uw_areas`** — named source bundles (D-12): `id, name, icon, is_default`.+ A source belongs to one or more areas; items inherit their source's areas at+ ingest time so scoping is a cheap indexed filter, not a join cascade.+- **`uw_sources` / `uw_sync_state`** — configured sources with their connector+ type, credential reference, schedule, and per-source cursor/checkpoint+ (backfill position, last success, last reconcile).+- **`uw_merge_log` / `uw_confirm_queue`** — reversible identity merges and the+ pending uncertain matches surfaced in the UI (doc 05).++## Why the normal wiki survives untouched++UltraWiki writes to its own tables and its own files; it treats the normal+wiki's vault as a read-only source. The mode switch (D-5/D-9) only decides+which system captures new knowledge and which system answers. This makes the+switch trivially reversible and keeps the zero-dependency wiki as the honest+fallback whenever an UltraWiki capability slot is unconfigured or its provider+is down.diff --git a/UltraWiki/02-connectors-and-ingestion.md b/UltraWiki/02-connectors-and-ingestion.mdnew file mode 100644index 0000000000..5514157fe8--- /dev/null+++ b/UltraWiki/02-connectors-and-ingestion.md@@ -0,0 +1,105 @@+# 02 · Connectors & the write path++## The connector contract (deliberately minimal)++A connector's whole job is: *"tell me what changed, as uniform raw items."*+It is a Python protocol registered through the existing Jarvis plugin+entry-point mechanism (new group: `uw_connector`):++```python+class UWConnector(Protocol):+ id: str # "obsidian-vault", "whatsapp-export", ...+ auth: AuthKind # none | local-path | export-file | oauth2 | apikey+ capabilities: Capabilities # backfill: bool+ # incremental: push | watch | cursor | none+ # deletes: bool++ def backfill(self, ctx, checkpoint=None) -> AsyncIterator[RawItem]: ...+ def incremental(self, ctx, cursor) -> AsyncIterator[RawItem]: ...+```++Hard rules, all in service of "anyone can write one, and it works everywhere":++1. **A connector yields `RawItem`s and nothing else.** It never touches the+ database, never embeds, never calls an LLM. Pure I/O — testable from+ fixtures with no network, no credentials, no models.+2. **`AsyncIterator`, not a list.** Backfills can be six-figure item counts;+ streaming lets the runtime own memory, batching, and checkpoints.+3. **The `capabilities` declaration drives the scheduler.** Connector authors+ never write scheduling logic; the runtime decides watch vs poll vs push+ from the declaration.+4. **Every `RawItem` carries `external_id`, `timestamp_utc`, and `permalink`.**+ Idempotency and deep-linking are non-negotiable from item one.++## Source families (v1 scope per D-4)++| Family | Examples | Backfill | Freshness | Notes |+|---|---|---|---|---|+| **Local artifacts** | Obsidian vault, chosen folders, Jarvis conversations, normal-wiki pages | read files | file watcher | Zero auth, zero network — the proving ground for the whole pipeline, and identical on every OS. |+| **Export imports** | WhatsApp "Export chat", Google Takeout, Instagram/Amazon/Netflix/Spotify exports | file import | re-import | The lawful, ban-risk-free way to get history out of closed platforms (GDPR-style data portability). Per-service parsers with fixture tests; an export re-import upserts idempotently. |+| **OAuth APIs** | Gmail, Google Calendar, Google Drive, GitHub | API paging | push where offered, else cursor polling | Reuses the existing `marketplace/` OAuth machinery and credential store. |+| **Jarvis plugin/CLI bridge** | anything already connected to Jarvis: MCP tools, marketplace plugins, connected CLIs | tool-defined | cursor polling | One generic connector that adapts any Jarvis-side integration exposing a "list items since X" capability into the `RawItem` stream. This is how "the whole life" scales without writing one bespoke connector per tool. |+| **Community connectors** | anything else | — | — | The contract + fixture harness is public; third-party connectors install like any Jarvis plugin. Connectors that would breach a platform's terms of service stay out of the core repo. |++## The staged write pipeline (D-7) — a state machine in the database++Ingestion is **not** a function chain. Each item carries its state as a+column; workers perform exactly one transition and commit. A crash or deploy+mid-backfill restarts to an identical end state — no duplicates, no gaps, no+lost work — and one poisoned item blocks nothing.++```+captured ──► keyword_indexed ──► embedded ──► distilled ──► entity_linked+ │ │ │ │ │+ └── retrying / failed (attempt_count, next_retry_at, dead-letter) ──┘+```++- **captured → keyword_indexed** (instant, no model): the raw body lands in+ the store and the full-text index in the same transaction. *Everything is+ findable by keyword within seconds of capture* — this stage alone already+ beats the normal wiki's coverage.+- **keyword_indexed → embedded** (async, cheap): the item's text — at this+ stage still raw or lightly normalized — is embedded with the chosen+ embedding model and written to `uw_documents`.+- **embedded → distilled** (async, the expensive stage): the chosen+ distillation LLM turns the item into normalized documents — a searchable+ question, a summary, the resolution, mentioned people/places/systems, plus+ notable **bursts** (high-signal fragments embedded separately with the+ parent topic prepended as context). Distilled documents replace the raw+ embedding as the primary semantic representation.+- **distilled → entity_linked**: extracted mentions are resolved against+ `uw_entities` (doc 05); episodic facts land in `uw_events` with absolute+ time ranges.++**Priority, not FIFO.** The distillation queue is ordered by value density:+new before old, information-rich before smalltalk (term-rarity and length+heuristics, reactions/stars as social boosts), sources the user actually+queries before dormant ones. During a ten-year backfill the system is usable+from minute one and visibly gets smarter every hour.++**Determinism economics.** Distillation output is cached on+`(content_hash, distill_prompt_version, model)` — identical input is never+paid for twice, and re-runs after crashes converge. When the distillation+prompt improves, a version bump re-enriches **incrementally in the+background**; there is never a throw-the-database-away re-import.++## Staying fresh (D-11)++- **Local sources**: file watchers fire within seconds (reusing the existing+ wiki-watcher pattern); a debounce collapses editor save storms.+- **Push where the platform offers it** (e.g. socket/webhook APIs): events are+ acknowledged immediately, deduplicated on the platform's stable event id,+ and enqueued. A thread-changing event re-fetches and re-writes the *whole*+ thread as one row, so stored conversations always reflect the complete+ current state.+- **Cursor polling for everything else**, per-source interval, adaptive+ (busy sources poll faster).+- **A per-source "Sync now" button** in the UI for impatience and debugging.+- **A nightly reconcile run** per source walks a recent window and repairs+ whatever push/watch missed — webhooks arrive twice, never, or out of order,+ and a desktop app has no public endpoint; polling is the correctness+ backstop, push is the latency bonus.+- **Deletions propagate.** A source-side deletion detected by event or+ reconcile sets a tombstone (`deleted_at`) and cascades to every derived+ document, embedding, and event. The system must never keep answering from+ content the user deleted at the source.diff --git a/UltraWiki/03-retrieval-and-voice.md b/UltraWiki/03-retrieval-and-voice.mdnew file mode 100644index 0000000000..f532589c4f--- /dev/null+++ b/UltraWiki/03-retrieval-and-voice.md@@ -0,0 +1,111 @@+# 03 · Retrieval & the day-one voice budget++## The read path++```+question+ │+ ▼+PLANNER (one fast LLM pass, 100–200 ms)+ slots: {entities, time window, place, semantic core, likely sources, area}+ │+ ▼+PARALLEL FAN-OUT (SQL, 50–150 ms total — all lists at once)+ keyword FTS · vector ANN · entity graph · time-range · profiles+ │+ ▼+RRF FUSION (pure arithmetic, ~0 ms)+ score(d) = Σ_lists weight / (60 + rank_list(d))+ dedupe chunks to their source · cap results per source+ │+ ▼+RERANK (small scoring model over top ~20 → keep top ~10)+ │+ ▼+CONTEXT EXPANSION (pull neighboring sections/messages back in)+ │+ ▼+SYNTHESIS (streamed LLM answer with citations)+```++Stage notes:++- **Planner.** Extracts structured slots from the question and picks which+ retrieval lists matter ("Viktoria" → entity lookup; "when" → the answer is a+ date; "dinner" → event-type filter `meal`; active area → SQL prefilter).+ Runs on the fastest configured model tier. If planning fails or times out,+ the fallback is a plain hybrid search over all lists — degraded, never dead.+- **Fan-out.** Every list is a single indexed SQL query against the unified+ store; they run concurrently. Recency decay and term-rarity weighting are+ baked into the keyword/vector list scoring, so stale answers lose ties and+ filler ("sounds good, thanks!") never surfaces on similarity alone.+- **Fusion (RRF, smoothing constant 60).** Consensus beats a single strong+ vote: a document appearing near the top of several lists outranks one that+ is first in only one. Weights are per-list and tunable; defaults to 1.0.+- **Rerank.** A small model scores each candidate against the actual question+ (0–10), killing look-alikes that share vocabulary but answer a different+ question. Uses the configured rerank-capable provider if present; skipped+ honestly when none is configured (fusion order then stands).+- **Context expansion.** Winners are re-hydrated with their surroundings — the+ neighboring wiki sections, the messages around a burst — so the synthesis+ model sees complete evidence, not orphaned fragments.+- **Synthesis.** Streams the answer with inline citations; every claim about+ the user's life must carry at least one evidence permalink. **No evidence →+ say so.** The system answers "I don't have that" rather than inventing a+ plausible dinner date.++## Cross-source reconstruction++The north-star answer often exists in no single row: the chat says "19:00?",+the calendar says "Dinner w/ Viktoria", the photo's metadata says San+Francisco. The event extraction on the write path (doc 02) has already fused+such fragments into `uw_events` rows with absolute time ranges, participants,+and evidence ids — so at read time, episodic questions hit a **precomputed+event**, and the synthesis stage merely verbalizes it with its citations.+Vector search over documents is the safety net for whatever extraction did+not anticipate, not the primary episodic path.++## Voice from day one (D-8): the latency budget++The realtime voice pipeline queries UltraWiki in v1. Budget to first spoken+token, measured not estimated:++| Stage | Budget |+|---|---|+| Planner pass (fast tier, capped) | ≤ 200 ms |+| Parallel fan-out (indexed SQL) | ≤ 150 ms |+| Fusion + rerank (rerank capped or skipped for voice) | ≤ 150 ms |+| Synthesis to first streamed token | ≤ 400 ms |+| **Total to first token** | **≤ 900 ms** |++Rules that make the budget reachable:++1. **Precomputed profiles.** Every entity keeps a stored, continuously+ re-summarized profile ("who is Viktoria", "what is Project X"), refreshed on+ the write path whenever linked items change. Identity and summary questions+ are a **single-row lookup**, no fan-out at all.+2. **Voice degrades stages, never blocks on them.** If rerank or planning+ would bust the budget, voice falls back to fusion order or plain hybrid+ search and still answers; the full pipeline remains available to chat/UI.+3. **Nothing warms up on the hot path.** Store connections, planner prompts,+ and embedding lookups for query text are prewarmed off the boot-critical+ path; a cold UltraWiki answers voice questions honestly ("memory is still+ waking up") instead of stalling the conversation.+4. **Voice answers are spoken-short.** The voice surface gets the answer+ sentence and offers detail on request; the full cited evidence packet+ renders in the UI transcript.++## Surfaces++Per the repo's CLI-first contract, retrieval ships as REST routes (which makes+it `jarvis api` CLI-reachable automatically), plus:++- **Wiki UI (Ultra mode)** — ask-and-answer view with citations, filters by+ area/source/time.+- **Brain tool** — the router/worker brains get a flat `ultrawiki_search`+ tool; agents and missions use the same primitive.+- **Primitive tools, not one oracle.** Following the Cerebras MCP design, the+ building blocks (`search`, `search_source`, `who_is`, `events_between`) are+ exposed individually — cheap, LLM-free, narrow inputs/outputs — so any agent+ can orchestrate them; the synthesized answer endpoint is a composition, not+ the only door.diff --git a/UltraWiki/04-configuration-and-ui.md b/UltraWiki/04-configuration-and-ui.mdnew file mode 100644index 0000000000..9e20050bee--- /dev/null+++ b/UltraWiki/04-configuration-and-ui.md@@ -0,0 +1,98 @@+# 04 · Configuration & UI++## The UltraWiki settings section (D-2)++UltraWiki gets its own configuration section, modeled on the API-Keys section:+one place where the user sees every capability slot, what is currently+selected, whether it is healthy, and what the alternatives are. **Jarvis+bundles nothing and provisions nothing** — this is open source; every slot is+filled by something the user brings. Every slot always offers **at least one+local and one cloud option**:++| Slot | Local option | Cloud option | Switch cost |+|---|---|---|---|+| **Storage** | SQLite file (created automatically under the data dir) | PostgreSQL connection string — any host the user has (own server, Supabase, Neon, RDS, …) | export/import migration, guided |+| **Embedding model** | multilingual local model via Ollama (bge-m3 class; one-time download) | any configured embedding-capable provider key (e.g. Gemini Embedding, OpenAI, Voyage, Mistral) | **full re-embed** — deliberate, wizard-guarded (D-3) |+| **Distillation model** | local model via Ollama | any configured chat-capable provider key | none (applies to new work; re-enrichment optional) |+| **Rerank (optional)** | local cross-encoder | rerank-capable provider | none |++Slot rules:++- **Capability-gated, never name-gated.** A provider qualifies for a slot by+ declaring the capability (embeddings, rerank, chat), not by being a specific+ brand — any present or future provider key the user owns can fill a slot.+ Model identifiers shown in the UI come from the provider's own catalog.+- **Credentials flow through the existing secret chain** (OS keyring → ENV →+ `.env` → local file). Nothing lands in config files or the repo. Connection+ strings are treated as secrets too.+- **Health is visible.** Each slot shows a live status (reachable / key+ missing / quota exhausted) with a one-click test, mirroring the API-Keys+ section's pattern. A dead slot degrades honestly (doc 01, principle 6) and+ says so here first.+- **Headless-safe.** The whole section is REST-backed, so every choice is also+ scriptable via the `jarvis` CLI on a server without a browser.++## The activation wizard (D-3, D-6)++Switching the Wiki section to Ultra mode the first time runs a short wizard —+the one moment where the semi-permanent choices are made consciously:++1. **Storage** — default: local SQLite file (zero setup). Advanced: paste a+ Postgres connection string.+2. **Embedding model** — the wizard lists the qualifying options from what the+ user actually has (installed Ollama models, configured provider keys) and+ marks a recommendation, stating the trade-off plainly: *cloud = higher+ quality and no download, but your text goes to the provider; local =+ private and offline, one-time model download, needs some hardware.* The+ choice is explicit because changing it later means re-embedding everything.+3. **Distillation model** — same option pattern; the wizard suggests matching+ the embedding privacy stance (a user who chose local embeddings for privacy+ is defaulted to local distillation, and vice versa) but the two are+ independently overridable.+4. **First sources** — enable the zero-auth local sources immediately+ (normal-wiki vault, Jarvis conversations, chosen folders); connect OAuth+ and export sources now or later.+5. **Areas (D-12)** — the wizard creates a default area and offers the+ starter set (e.g. Work / Private); each connected source is assigned to+ one or more areas.++The wizard ends by kicking off the staged import (D-7) and switching the mode.+Everything chosen here remains editable in the settings section afterwards —+the embedding model behind an "are you sure, this re-embeds N documents,+estimated cost/time X" gate that runs the re-embed as a background job while+the old index keeps serving until the new one is complete.++## The mode switch (D-5, D-9)++- A prominent Normal / Ultra switch lives at the top of the Wiki section.+ Exactly one mode is active; the active one owns capture and answering.+- Switching to Ultra: normal wiki keeps its files; Ultra ingests them as a+ source and takes over. Switching back: Ultra pauses (store untouched),+ normal wiki resumes. Both directions are instant, safe, and reversible;+ neither ever deletes anything.+- If Ultra is active but a required slot is dead (e.g. the only embedding key+ is depleted), the section banners the problem, answers what it still can+ (keyword + entity + time lists need no external provider), and links to the+ settings slot to fix it. It does not silently flip modes.++## Ultra-mode UI surfaces++- **Ask view** — the question box; streamed cited answer; every citation is a+ permalink that opens the original (the Obsidian note, the mail, the chat+ export line). Filters: area, source, time range.+- **Sources view** — the connected-source list with per-source state: last+ sync, backlog counts per pipeline stage (captured / embedded / distilled),+ "Sync now", pause, area assignment, disconnect (with a data-retention+ choice: keep or purge ingested rows).+- **Import progress** — during a backfill, one honest progress surface:+ items captured, keyword-searchable now, distillation backlog, current+ spend estimate for cloud slots.+- **People & confirmations** — the entity list with profiles, and the+ confirmation queue for uncertain identity matches (doc 05). A small badge+ on the Wiki nav shows pending confirmations.+- **Memory map** — the existing graph visualization gets an Ultra-mode+ equivalent rendering entities and their linked sources instead of wiki+ pages.++All UI strings are i18n keys with English source text; the user-visible agent+name follows the dynamic wake-word brand rule.diff --git a/UltraWiki/05-identity-areas-privacy.md b/UltraWiki/05-identity-areas-privacy.mdnew file mode 100644index 0000000000..b87f18b4d1--- /dev/null+++ b/UltraWiki/05-identity-areas-privacy.md@@ -0,0 +1,83 @@+# 05 · Identity, areas & privacy++## Identity resolution (D-10)++The single most dangerous failure in a personal memory is a **wrong merge**:+fuse two people into one entity and every answer about either is silently+wrong, discovered months later. The design therefore splits resolution into+three tiers:++1. **Deterministic — merge automatically.** Same phone number, same email+ address, an exact contact-book match. These identifiers are unique enough+ that automation is safe.+2. **Probable — queue for confirmation.** Name similarity, nickname patterns,+ co-occurrence in the same threads ("Viki" appears exactly where Viktoria's+ number appears). The match is *proposed*, never applied: it lands in the+ **confirmation queue** and both identities keep answering separately until+ the user confirms ("Is Viki = Viktoria Müller?" — one tap). <!-- i18n-allow: illustrative German name in the identity-merge example -->+3. **Weak — do nothing.** Below the proposal threshold, identities stay+ separate; a wrong split is annoying but repairable, a wrong merge is+ poison.++Every merge — automatic or confirmed — is written to `uw_merge_log` with the+evidence that justified it and is **reversible in one action**: unmerging+restores the previous identifier mapping and re-links affected documents and+events. The queue lives in the People view (doc 04) and stays short by+design; resolution runs on the write path so the queue fills gradually, not+in one avalanche.++Seed data: the existing Jarvis contacts store provides the initial entities+and identifiers, so day one already knows the user's actual circle.++## Areas (D-12)++Areas are named bundles of sources — Work, Private, Project X — and exist+from v1:++- A source belongs to one or more areas; items inherit their source's areas at+ ingest, denormalized onto the row, so scoping is one indexed filter.+- **Search, chat, and voice accept an area scope** ("nur Arbeit" spoken, a+ filter chip in the UI, a parameter on the REST route).+ <!-- i18n-allow: German spoken voice-scope example the matcher must accept -->+- The activation wizard creates a default area; a query without a scope runs+ over everything, and the planner may narrow to an area when the question+ implies one.+- Areas are metadata, not walls: they tune relevance and let the user aim a+ question. They are **not** a security boundary within the single-user store.++## Privacy model++The corpus UltraWiki accumulates is the most sensitive dataset its user will+ever hold in one place. The stance:++1. **Everything can stay on-device.** With local storage + local embedding ++ local distillation, no byte of content ever leaves the machine. This+ fully-local configuration is a first-class, tested path — not a degraded+ afterthought.+2. **Cloud is a conscious, per-slot choice.** The activation wizard states in+ plain language which raw content each cloud choice would see (distillation+ sees full raw text; embedding sees the distilled documents; a cloud+ database stores everything). No silent defaults into the cloud.+3. **Secrets never enter the corpus.** Ingestion runs the existing+ secret-pattern scrubbing before storage; API keys pasted into a chat years+ ago must not become retrievable memory.+4. **Deletion is honored end-to-end.** Source-side deletions tombstone and+ cascade (doc 02). A disconnect offers purge; purge removes items,+ documents, embeddings, events, and entity links derived from that source.+ Nothing survives in caches — the distillation cache is keyed by content+ hash and purged with its items.+5. **Encryption at rest, v1 stance:** the store inherits the device's disk+ encryption; the design keeps a per-store passphrase (SQLCipher /+ pgcrypto-style) as a tracked roadmap item rather than a v1 requirement, so+ the cross-platform base install stays dependency-light. Documented+ honestly in the user-facing docs.+6. **The corpus never leaves via git.** The store lives under the data dir,+ which is gitignored like all user data; nothing in these designs ever+ writes user content into the repository.++## What the mode switch does NOT do (D-9)++Switching modes never migrates, converts, or deletes content in either+direction. The normal wiki's markdown stays the user's readable, portable+property; UltraWiki's store stays intact while paused. The only coupling is+one-way and read-only: UltraWiki ingests the normal wiki as a source.diff --git a/UltraWiki/06-roadmap.md b/UltraWiki/06-roadmap.mdnew file mode 100644index 0000000000..db69da91c2--- /dev/null+++ b/UltraWiki/06-roadmap.md@@ -0,0 +1,104 @@+# 06 · Roadmap — build order with hard gates++v1 ships all phases below (the maintainer scoped v1 wide: all source+families, voice from day one). The phases are the **build order**, and each+gate must be true — proven by automated tests or measured numbers, not+claimed — before the next phase starts. The discipline lives in the gates.++## P1 · Store & pipeline runtime++The unified store (SQLite backend first), the staged state machine, worker+loop with retry/backoff/dead-letter, idempotent upserts, the dialect adapter+skeleton for Postgres.++**Gate — four scenarios green as automated tests, offline:**+(a) a 1000+-item backfill hard-killed mid-run restarts to an identical end+state — no duplicates, no gaps; (b) a connector throwing at item 500 leaves+1–499 finished and 500 in `failed`, nothing blocked; (c) a second run over+unchanged data creates zero new work (content-hash proof); (d) the entire+suite runs with no network, no credentials, no models.++## P2 · Local connectors + activation wizard++The zero-auth connectors (normal-wiki vault, Jarvis conversations, chosen+folders), the connector fixture-test harness, the settings section skeleton,+the activation wizard with the storage/embedding/distillation choices, the+mode switch (both directions, non-destructive).++**Gate:** a fresh install activates Ultra mode end-to-end with only local+options on Windows, macOS, and headless Linux; switching back and forth loses+nothing; a stranger can write and CI-test a new connector from fixtures alone.+If the connector contract feels awkward here, fix the contract now — before+P6 multiplies it.++## P3 · Retrieval core++Keyword + vector + time lists, RRF fusion, optional rerank, context+expansion, cited synthesis; the Ask view in the Wiki UI; REST routes (and+therefore CLI); the staged-import progress surface; areas end-to-end+(wizard → ingest tagging → filter chip).++**Gate:** on a real ingested corpus, a set of 30+ known-answer questions+returns the correct evidence in the top results with working permalinks;+cloud slots absent → keyword/time/entity paths still answer honestly.++## P4 · Voice integration++The `ultrawiki_search`/`who_is` primitives as brain tools, voice-tier+degradation rules, prewarming off the boot path, precomputed entity/topic+profiles.++**Gate (D-8):** ≤ 900 ms to first spoken token, **measured** on the reference+desktop against a realistically sized corpus, for both a profile lookup and a+fan-out question; a cold or degraded UltraWiki never stalls the voice+conversation.++## P5 · Identity & events++Entities/identifiers seeded from contacts, deterministic auto-merge,+probable-match confirmation queue with reversible merges, the People view,+episodic event extraction with absolute time anchoring, bi-temporal fact+handling.++**Gate:** a golden set of known people resolves with **zero wrong merges**+(uncertain cases provably queue); the north-star dinner question is answered+correctly — date, place, participants, confidence, permalinks — from a real+multi-source data slice. *This is where the project proves its promise.*++## P6 · The wide world of sources++Export importers (WhatsApp first, then takeout-style archives), OAuth+connectors (Gmail, Calendar, Drive, GitHub) over the marketplace machinery,+the generic Jarvis plugin/CLI bridge, per-source reconcile + tombstones,+the Postgres backend promoted to a tested first-class option.++**Gate:** each connector family passes its fixture suite plus one real-world+end-to-end run; deletion propagation is demonstrated; the same corpus works+against both storage backends.++## P7 · Evaluation as a permanent gate++A 100+-question eval set over a reference corpus, retrieval recall measured+separately from answer accuracy, latency tracked per stage; wired into CI so+a regression breaks the build. Only after P7 is prompt-tuning worth anyone's+time.++**Gate:** the eval harness runs in CI; the v1 numbers are recorded as the+baseline every future change is measured against.++---++## Standing constraints (all phases)++- **Universality:** every phase works with whatever single provider key the+ user has, on all three OSes including headless Linux; local-only is always+ a complete path. "Works on the maintainer's machine" is the defect, not+ the proof.+- **Off the hot path:** no UltraWiki initialization on the boot or voice+ critical path; heavy imports stay lazy.+- **CLI-first:** every user-facing action lands as a REST route (hence CLI);+ destructive routes carry the danger metadata.+- **English artifacts,** i18n keys for UI strings, multilingual behavior for+ user content — the corpus and the questions may be in any language, so+ multilingual embedding/distillation choices are the default+ recommendations, never an English-tuned bias.diff --git a/UltraWiki/README.md b/UltraWiki/README.mdnew file mode 100644index 0000000000..b0ec123efa--- /dev/null+++ b/UltraWiki/README.md@@ -0,0 +1,90 @@+# UltraWiki — the semantic memory mode++> **Status: design only. Nothing here is implemented yet.** This folder is the+> specification that coding agents will later build from. It was written from+> scratch on 2026-07-24, based on the Cerebras Knowledge architecture+> (see [Prior art](#prior-art)) and twelve maintainer decisions recorded below.+> Earlier design documents that once lived in this folder were deliberately+> discarded; this set does not build on them.++UltraWiki is the second mode of the Jarvis Wiki section. Where the normal wiki+is a local, keyword-searched collection of markdown pages, UltraWiki is a+**semantic personal memory**: it continuously ingests everything the user+chooses to connect — local files, chat exports, mail, calendar, code, and any+data reachable through Jarvis's own plugins and CLIs — and answers questions+about the user's own life with **cited, exact facts**, fast enough to feed the+**realtime voice pipeline from day one**.++The north-star query used as the worked example throughout these documents:++> **"When was I at dinner with Viktoria in San Francisco?"**+>+> → *"On 23 June 2024, at Trestle in San Francisco. Sources: WhatsApp export+> (23 Jun), calendar event 'Dinner w/ Viktoria'."*++Answering that well requires entities (who is Viktoria), time (a date IS the+answer), places, activity semantics (dinner ≈ restaurant ≈ essen), and reading+the right thread out of years of history in a few hundred milliseconds.+<!-- i18n-allow: "essen" is a German activity-synonym example the multilingual matcher must handle -->++---++## The two modes (either-or, risk-free switching)++The Wiki section offers exactly one active mode at a time (maintainer decision+D-5). The switch is **role-based, never destructive** (D-9):++| | **Normal Wiki** | **UltraWiki** |+|---|---|---|+| Store | Obsidian markdown + FTS index | unified semantic store (SQL + vectors + entities) |+| Search | keyword | hybrid: keyword + vector + entity graph + time |+| Sources | Jarvis conversations | every connected source, incl. the normal wiki itself |+| Answers | page links | cited answers with exact dates, people, places |+| Needs | nothing (offline, free) | user-supplied storage + embedding + distillation choices |+| Voice | page lookups | full semantic answers within the realtime latency budget |++- Activating UltraWiki ingests the complete normal wiki as one of its sources —+ nothing is lost by switching forward.+- Switching back pauses UltraWiki (its store stays on disk untouched) and the+ normal wiki simply resumes. Nothing is ever deleted by the mode switch.+- While UltraWiki is active, it fully replaces the normal wiki as the capture+ and answer system.++## Decision log (maintainer, 2026-07-24)++| # | Decision |+|---|---|+| D-1 | Design written from scratch; earlier cleared design docs are not a basis. |+| D-2 | **Bring-your-own everything.** Jarvis bundles and provisions no database and no service. A dedicated UltraWiki settings section (modeled on the API-Keys section) lets the user pick storage, models, and sources — always with at least one local AND one cloud option per slot. |+| D-3 | The embedding model is a **one-time deliberate choice in the activation wizard** (switching later triggers an explicit, cost-estimated re-embed). |+| D-4 | Source scope is "the whole life": local files (Obsidian, Jarvis conversations, folders), export-file imports (WhatsApp, takeouts), OAuth APIs (Google mail/calendar/drive, GitHub), and a **generic bridge that turns every connected Jarvis plugin/CLI into a data source**. |+| D-5 | UI is an **either-or mode switch** inside the Wiki section; the active mode replaces the other completely. |+| D-6 | The distillation model (the LLM that summarizes raw content before storage) is chosen in the same activation wizard — local or cloud, one conscious privacy decision. |+| D-7 | The first big import is **staged**: keyword-searchable immediately, embeddings async, LLM distillation progressively by priority. Usable from minute one. |+| D-8 | **Voice from day one.** The realtime voice pipeline queries UltraWiki in v1; the sub-second latency budget applies from the start. |+| D-9 | Mode switching is non-destructive in both directions; both stores persist. |+| D-10 | Identity resolution: certain matches merge automatically; uncertain ones go to a **confirmation queue** in the UI; every merge is reversible. |+| D-11 | Freshness: always-on background sync (watchers, push where available, cursor polling) + a per-source "sync now" button + a nightly reconcile run. |+| D-12 | **Areas from the start**: sources are grouped into named areas (e.g. Work / Private / Project X) in v1; search and voice can be scoped to an area. |++## Document index++| File | Covers |+|---|---|+| [`01-architecture.md`](01-architecture.md) | Principles, layer model, the unified store and its schema |+| [`02-connectors-and-ingestion.md`](02-connectors-and-ingestion.md) | Connector contract, source families, the staged write pipeline, freshness |+| [`03-retrieval-and-voice.md`](03-retrieval-and-voice.md) | The read path, hybrid search + fusion + rerank, the voice latency budget |+| [`04-configuration-and-ui.md`](04-configuration-and-ui.md) | The settings section, activation wizard, provider slots, UI surfaces |+| [`05-identity-areas-privacy.md`](05-identity-areas-privacy.md) | Entity resolution, the confirmation queue, areas, privacy and deletion |+| [`06-roadmap.md`](06-roadmap.md) | Build phases with hard gates |++## Prior art++- **Cerebras, "How Cerebras Built Its Enterprise Knowledge Base"** — the+ architectural template: meet data where it lives; one unified embeddings+ table; distill before embedding; hybrid retrieval fused with RRF; a+ planner → parallel executor → synthesis read path; retrieval primitives+ exposed as simple tools for agents; scoped search.+- **Anthropic, "Introducing Contextual Retrieval"** — prepend context to each+ chunk before embedding (cited by the Cerebras article as technique (2)).+- **Cormack et al., SIGIR 2009** — reciprocal rank fusion.