Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (round 19): drop unused brain-note query params, update docs to match

Adam Eivy7797aa61c5b0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cf89c2812a..4bcb97420c 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,7 +2,7 @@
## Added
-- **"Ask Yourself" — conversational digital twin (slice a: text chat + sources)** — a new top-level page (`/ask`, deep-linked at `/ask/:conversationId`) that runs a retrieval-augmented chat against your own data. Every question fans out in parallel across memory (hybrid BM25 + vector), brain notes (ideas / projects / inbox), autobiography stories, goals, and calendar events; results are reranked with kind-weighted scoring (memory + goals weighted highest) and deduped by source id. The persona preamble is sourced from `character.json` so answers come back in the user's voice; three modes (`ask` / `advise` / `draft`) swap directives without changing the source pipeline. Streaming is wired end-to-end: API providers stream OpenAI-style SSE chunks; CLI providers fall back to a single-shot completion. Each assistant turn renders source chips that deep-link to the origin (`/brain/memory?id=…`, `/digital-twin/goals?id=…`, `/calendar/agenda?date=…`, etc.). Conversations persist as JSON under `data/ask-conversations/<id>.json`, auto-expire after 30 days unless pinned (📌 button on the conversation header), and are listable in a sidebar. The user turn is persisted before streaming starts so a mid-stream disconnect still leaves the question on disk.
+- **"Ask Yourself" — conversational digital twin (slice a: text chat + sources)** — a new top-level page (`/ask`, deep-linked at `/ask/:conversationId`) that runs a retrieval-augmented chat against your own data. Every question fans out in parallel across memory (hybrid BM25 + vector), brain notes (ideas / projects / inbox), autobiography stories, goals, and calendar events; results are reranked with kind-weighted scoring (memory + goals weighted highest) and deduped by source id. The persona preamble is sourced from `character.json` so answers come back in the user's voice; three modes (`ask` / `advise` / `draft`) swap directives without changing the source pipeline. Streaming is wired end-to-end: API providers stream OpenAI-style SSE chunks; CLI providers fall back to a single-shot completion. Each assistant turn renders source chips that navigate to the origin section (Brain Memory, Goals, Calendar Agenda, Autobiography); chips for Goals deep-link to the specific record via existing `?id=` routing, while Brain Memory and Calendar Agenda chips land on the section page until those views grow record-level deep-link handling. Each chip carries the record id in `meta` so a future slice-b enhancement can wire record-level routing without changing the source contract. Conversations persist as JSON under `data/ask-conversations/<id>.json`, auto-expire after 30 days unless pinned (📌 button on the conversation header), and are listable in a sidebar. The user turn is persisted before streaming starts so a mid-stream disconnect still leaves the question on disk.
**Nav integration**: registered in `server/lib/navManifest.js` (`nav.ask`) with aliases `ask`, `ask-yourself`, `twin-chat` so `⌘K` and the voice agent's `ui_navigate` resolve "ask" to `/ask` automatically. Sidebar entry alphabetized between Apps and Brain.
diff --git a/PLAN.md b/PLAN.md
index 8298775d35..9f07cb6877 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -85,7 +85,7 @@ Three high-value work items drawn from an inventory of the current app surface (
### 3. "Ask Yourself" — Unified Conversational Twin over Brain + Memory + Goals + Identity + Calendar — slice (a) ✅ SHIPPED 2026-04-24
-> **Slice (a) — text chat + sources — shipped.** `/ask` and `/ask/:conversationId` are live. `server/services/askService.js` orchestrates parallel retrieval across memory (hybrid), brain notes, autobiography, goals, and calendar with kind-weighted reranking. Persona preamble is sourced from `character.json`. Three modes (`ask` / `advise` / `draft`) swap directives. API providers stream SSE; CLI providers single-shot. Conversations persist to `data/ask-conversations/<id>.json` with 30-day auto-expiry unless pinned. Source chips deep-link back to origin. Registered in the nav manifest so `⌘K` and voice (`ui_navigate`) resolve "ask" automatically. **Slice (b) (voice + promotion actions) still pending** — see backlog item below.
+> **Slice (a) — text chat + sources — shipped.** `/ask` and `/ask/:conversationId` are live. `server/services/askService.js` orchestrates parallel retrieval across memory (hybrid), brain notes, autobiography, goals, and calendar with kind-weighted reranking. Persona preamble is sourced from `character.json`. Three modes (`ask` / `advise` / `draft`) swap directives. API providers stream SSE; CLI providers single-shot. Conversations persist to `data/ask-conversations/<id>.json` with 30-day auto-expiry unless pinned. Source chips navigate to the origin section landing page (Goals chips additionally deep-link to the record via existing `?id=` routing); record ids ride in `meta` so slice (b) can add record-level deep-linking for Brain Memory / Calendar Agenda without changing the source contract. Registered in the nav manifest so `⌘K` and voice (`ui_navigate`) resolve "ask" automatically. **Slice (b) (voice + promotion actions) still pending** — see backlog item below.
>
> 40 new tests (askService 11, askConversations 17, ask routes 12); full server suite stays green at 2549/2549.
@@ -116,7 +116,7 @@ Three high-value work items drawn from an inventory of the current app surface (
**Definition of done (slice a).**
- `/ask` page accepts a question, streams an answer in the twin's voice, shows ≥3 source chips per answer.
-- Clicking a source deep-links to the origin (Brain note, Memory item, Goal, Calendar event).
+- Clicking a source navigates to the origin section (Goal chips deep-link to the record; Brain Memory + Calendar Agenda chips land on the section page until record-level routing lands in slice b).
- Conversations persist and are listable at `/ask`.
- `Cmd+K` → typing a question routes into a new conversation.
diff --git a/server/services/askService.js b/server/services/askService.js
index 09446e014b..deef677dbe 100644
--- a/server/services/askService.js
+++ b/server/services/askService.js
@@ -154,13 +154,17 @@ async function retrieveBrainNotes(question, queryTokens) {
]);
const candidates = [];
+ // Brain Memory tab doesn't currently consume `type`/`id` query params, so
+ // chips land on the section page; the record id rides in `meta` for a
+ // future record-level deep-link to consume without touching the source
+ // shape. (Same pattern as memory/calendar after round 18.)
for (const idea of ideasArr || []) {
const text = `${idea.title || ''} ${idea.description || ''}`.trim();
- candidates.push({ kind: 'brain-note', subkind: 'idea', recordId: idea.id, title: idea.title || '(idea)', snippet: normalizeSnippet(text), href: `/brain/memory?type=ideas&id=${encodeURIComponent(idea.id)}`, updatedAt: idea.updatedAt || idea.createdAt });
+ candidates.push({ kind: 'brain-note', subkind: 'idea', recordId: idea.id, title: idea.title || '(idea)', snippet: normalizeSnippet(text), href: '/brain/memory', updatedAt: idea.updatedAt || idea.createdAt });
}
for (const proj of projectsArr || []) {
const text = `${proj.title || ''} ${proj.description || ''}`.trim();
- candidates.push({ kind: 'brain-note', subkind: 'project', recordId: proj.id, title: proj.title || '(project)', snippet: normalizeSnippet(text), href: `/brain/memory?type=projects&id=${encodeURIComponent(proj.id)}`, updatedAt: proj.updatedAt || proj.createdAt });
+ candidates.push({ kind: 'brain-note', subkind: 'project', recordId: proj.id, title: proj.title || '(project)', snippet: normalizeSnippet(text), href: '/brain/memory', updatedAt: proj.updatedAt || proj.createdAt });
}
for (const entry of inbox || []) {
// Brain inbox records use `capturedText` / `capturedAt` (see
@@ -174,6 +178,7 @@ async function retrieveBrainNotes(question, queryTokens) {
for (const c of candidates) {
c.relevance = lexicalScore(`${c.title} ${c.snippet}`, queryTokens);
c.id = `brain-note:${c.subkind}:${c.recordId}`;
+ c.meta = { subkind: c.subkind, recordId: c.recordId, updatedAt: c.updatedAt };
}
return rankAndCap(candidates, 'brain-note');
}