Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(memory): extract Session facts from recordings, notes and personal mail

muterC3689ac0b47ca
diff --git a/apps/node-services/src/memory/README.md b/apps/node-services/src/memory/README.md
index a7117271..73725f3c 100644
--- a/apps/node-services/src/memory/README.md
+++ b/apps/node-services/src/memory/README.md
@@ -169,7 +169,13 @@ Core configuration:
and does not start without it. It also enables the Raw Chunk persistent index and search.
- The full Raw Chunk reconciliation runs once at service start and then at the built-in interval.
- Session facts: after Raw Chunk sync finishes an Agent (without blocking indexing), Memory extracts Session facts
- from its Room source text into `memory_index.session_facts`, following Hindsight retain. Consecutive Chunks form
+ into `memory_index.session_facts`, following Hindsight retain. Facts come from Room conversations, recording
+ transcripts, Pocket Notes and imported mail; My pages, the Wiki, period reports and the Profile stay chunk-only.
+ Mail is chosen by the `- Class:` line TeamHub writes into it: `self_sent`, `direct_inbound` and
+ `system_notification` are extracted, and so is every message of a thread with a `self_sent` message; marketing,
+ subscriptions and drafts are not. Each window's Context line names its origin, so the one prompt knows a
+ transcript may not label speakers, mail must tell the sender from the user, and a notification may hold no facts.
+ Consecutive Chunks form
windows of at most 3,000 characters, extracted with `apps/node-services/prompts/memory/facts/fact-extraction.md`
(the Hindsight concise prompt) at low reasoning effort. Up to 16 windows form one batch, and each batch runs as one
ModelCall chain of kind `memory`, keyed `memory.facts:<sha256 of the batch's sorted window hashes>` so a restart
diff --git a/apps/node-services/src/memory/session-fact-index.ts b/apps/node-services/src/memory/session-fact-index.ts
index 4f1a1625..dfe4777d 100644
--- a/apps/node-services/src/memory/session-fact-index.ts
+++ b/apps/node-services/src/memory/session-fact-index.ts
@@ -33,8 +33,21 @@ const FACT_RESULTS = 30;
/** Extraction chains one sync keeps on its endpoint's queue at once; the
* queue decides how many of them run. */
const DEFAULT_EXTRACTION_CONCURRENCY = 2;
-/** Facts come from Room conversations; documents keep Raw chunk recall only. */
-const ROOM_SOURCE_URI = "teamhub://rooms/%/messages";
+/** Raw origins facts are extracted from. My pages, the Wiki, period reports
+ * and the Profile keep Raw chunk recall only: documents are read on demand and
+ * the others are derived or already structured. */
+const FACT_ORIGINS = ["room", "recording", "pocket_note", "mail"];
+/** Mail classes extracted on their own; a thread the Human replied to is
+ * extracted whole, whatever its classes. Marketing, subscriptions and drafts
+ * stay chunk-only. */
+const FACT_MAIL_CLASSES = [
+ "self_sent",
+ "direct_inbound",
+ "system_notification",
+];
+/** The header lines TeamHub writes into imported mail Markdown. */
+const MAIL_CLASS_LINE = "\n- Class: ([a-z_]+)\n";
+const MAIL_THREAD_LINE = "\n- Thread ID: `([^`\n]+)`\n";
const MESSAGE_HEADING = /^## (\d{4}-\d{2}-\d{2}T\S+) · (.+)$/gmu;
/** The contract's model-visible Session fact with its Raw read handle. */
@@ -55,7 +68,7 @@ export interface FactSearchInput extends ChunkSearchInput {
event_to?: string;
}
-/** One Room Raw source at its active version. */
+/** One Raw source facts are extracted from, at its active version. */
interface FactSource {
id: string;
tenant_id: string;
@@ -64,6 +77,9 @@ interface FactSource {
active_sha256: string;
content: string;
date: string | null;
+ origin_kind: string;
+ mail_class: string | null;
+ replied: boolean;
}
interface PendingWindow {
@@ -135,15 +151,15 @@ export function messageAt(
}
/**
- * Extracts Session facts from Room Raw sources, independent of Wiki
- * generation, and serves the fact recall branches. Facts belong to a window of
+ * Extracts Session facts from conversation, transcript, Pocket Note and mail
+ * Raw sources, independent of Wiki generation, and serves the fact recall
+ * branches. Facts belong to a window of
* the active Raw version; an unchanged window keeps its facts across versions.
*/
export class SessionFactIndex {
readonly #sql: postgres.Sql;
readonly #extract: typeof extractWindowBatch;
readonly #concurrency: number;
- readonly #sourceUris: string;
// One sync per Agent at a time, so repeated triggers never extract twice.
readonly #agents = new Map<string, Promise<unknown>>();
@@ -153,16 +169,13 @@ export class SessionFactIndex {
extract?: typeof extractWindowBatch;
/** Extraction calls in flight per sync. */
concurrency?: number;
- /** SQL LIKE pattern of the Raw source URIs facts are extracted from. */
- sourceUris?: string;
}) {
this.#extract = options.extract ?? extractWindowBatch;
this.#concurrency = options.concurrency ?? DEFAULT_EXTRACTION_CONCURRENCY;
- this.#sourceUris = options.sourceUris ?? ROOM_SOURCE_URI;
this.#sql = options.sql;
}
- /** Extract new windows of an Agent's Room sources and drop changed ones. */
+ /** Extract new windows of an Agent's fact sources and drop changed ones. */
syncAgent(agentId: string): Promise<FactSyncResult> {
const run = (this.#agents.get(agentId) ?? Promise.resolve())
.catch(() => undefined)
@@ -173,14 +186,33 @@ export class SessionFactIndex {
async #syncAgent(agentId: string): Promise<FactSyncResult> {
const sources = await this.#sql<FactSource[]>`
- SELECT source.id, source.tenant_id, source.owner_id, source.agent_id,
- source.active_sha256, version.content, version.manifest->>'date' AS date
- FROM memory_index.sources source
- JOIN memory_index.source_versions version
- ON version.source_id = source.id AND version.sha256 = source.active_sha256
- WHERE source.agent_id = ${agentId}
- AND source.source_uri LIKE ${this.#sourceUris}
- ORDER BY source.id`;
+ WITH candidate AS (
+ SELECT source.id, source.tenant_id, source.owner_id, source.agent_id,
+ source.active_sha256, version.content,
+ version.manifest->>'date' AS date, source.origin_kind,
+ CASE WHEN source.origin_kind = 'mail'
+ THEN substring(version.content from ${MAIL_CLASS_LINE}) END AS mail_class,
+ CASE WHEN source.origin_kind = 'mail'
+ THEN substring(version.content from ${MAIL_THREAD_LINE}) END AS mail_thread
+ FROM memory_index.sources source
+ JOIN memory_index.source_versions version
+ ON version.source_id = source.id AND version.sha256 = source.active_sha256
+ WHERE source.agent_id = ${agentId}
+ AND source.origin_kind = ANY(${FACT_ORIGINS}::text[])
+ ), replied AS (
+ SELECT DISTINCT mail_thread FROM candidate
+ WHERE mail_class = 'self_sent' AND mail_thread IS NOT NULL
+ )
+ SELECT candidate.id, candidate.tenant_id, candidate.owner_id,
+ candidate.agent_id, candidate.active_sha256, candidate.content,
+ candidate.date, candidate.origin_kind, candidate.mail_class,
+ replied.mail_thread IS NOT NULL AS replied
+ FROM candidate
+ LEFT JOIN replied ON replied.mail_thread = candidate.mail_thread
+ WHERE candidate.origin_kind <> 'mail'
+ OR candidate.mail_class = ANY(${FACT_MAIL_CLASSES}::text[])
+ OR replied.mail_thread IS NOT NULL
+ ORDER BY candidate.id`;
const result = {
sources: sources.length,
windows: 0,
@@ -188,6 +220,29 @@ export class SessionFactIndex {
facts: 0,
failed: 0,
};
+ // One query each for the Agent's extracted windows and for sources whose
+ // facts point at an older version, instead of two per source: mail makes
+ // sources number in the thousands.
+ const sourceIds = sources.map((source) => source.id);
+ const doneBySource = new Map<string, Set<string>>();
+ for (const row of await this.#sql<
+ { source_id: string; window_sha256: string }[]
+ >`
+ SELECT source_id, window_sha256 FROM memory_index.session_fact_windows
+ WHERE source_id = ANY(${sourceIds}::text[])`) {
+ const done = doneBySource.get(row.source_id) ?? new Set<string>();
+ done.add(row.window_sha256);
+ doneBySource.set(row.source_id, done);
+ }
+ const outdated = new Set(
+ (
+ await this.#sql<{ source_id: string }[]>`
+ SELECT DISTINCT fact.source_id FROM memory_index.session_facts fact
+ JOIN memory_index.sources source ON source.id = fact.source_id
+ WHERE fact.source_id = ANY(${sourceIds}::text[])
+ AND fact.source_sha256 <> source.active_sha256`
+ ).map((row) => row.source_id),
+ );
// Pending windows by owner: a batch runs on one owner's Agent Runtime.
const pending = new Map<string, PendingWindow[]>();
for (const source of sources) {
@@ -195,13 +250,7 @@ export class SessionFactIndex {
const windows = factWindows(chunks);
result.windows += windows.length;
const current = new Set(windows.map((window) => window.sha256));
- const done = new Set(
- (
- await this.#sql<{ window_sha256: string }[]>`
- SELECT window_sha256 FROM memory_index.session_fact_windows
- WHERE source_id = ${source.id}`
- ).map((row) => row.window_sha256),
- );
+ const done = doneBySource.get(source.id) ?? new Set<string>();
// A changed window (new messages in the last one) is extracted again.
const stale = [...done].filter((sha) => !current.has(sha));
if (stale.length)
@@ -211,7 +260,7 @@ export class SessionFactIndex {
await sql`DELETE FROM memory_index.session_fact_windows
WHERE source_id = ${source.id} AND window_sha256 = ANY(${stale}::text[])`;
});
- await this.#rebind(source, chunks);
+ if (outdated.has(source.id)) await this.#rebind(source, chunks);
const owner = `${source.tenant_id}\n${source.owner_id}`;
windows.forEach((window, index) => {
if (done.has(window.sha256)) return;
@@ -222,8 +271,8 @@ export class SessionFactIndex {
window,
index,
total: windows.length,
- eventDate: eventDate(source.content, window, source.date),
- context: `Conversation session on ${source.date ?? "an unknown date"}`,
+ eventDate: eventDate(source, window),
+ context: factContext(source),
},
});
pending.set(owner, list);
@@ -321,7 +370,7 @@ export class SessionFactIndex {
await this.#sql.begin(async (sql) => {
for (const [ordinal, fact] of facts.entries()) {
const chunk = factChunk(fact, window.chunks);
- const message = messageAt(source.content, chunk.start);
+ const message = roomMessageAt(source, chunk.start);
const id = `msf_${createHash("sha256")
.update(`${source.id}:${window.sha256}:${ordinal}`)
.digest("hex")
@@ -477,13 +526,45 @@ export function createSessionFactIndexFromEnvironment(
});
}
+/**
+ * The window's Context line: what kind of text it is and whose words it holds,
+ * so one extraction prompt serves every origin.
+ */
+export function factContext(
+ source: Pick<FactSource, "origin_kind" | "mail_class" | "replied" | "date">,
+): string {
+ const on = `on ${source.date ?? "an unknown date"}`;
+ switch (source.origin_kind) {
+ case "recording":
+ return `Meeting recording transcript ${on}, recorded by the user. Speakers may be unlabeled and are unknown; attribute a statement, commitment or decision to the user only when the text identifies the user as its speaker.`;
+ case "pocket_note":
+ return `The user's own Pocket Note ${on}.`;
+ case "mail":
+ return source.mail_class === "system_notification" && !source.replied
+ ? `Automated email ${on}, received by the user. Keep only what concerns the user: a booking, an appointment, a deadline or a changed time. A promotion, digest or plain receipt has no facts; return none.`
+ : `Email ${on} in the user's mailbox. The From line names the sender; the user is the mailbox owner. Attribute each fact to the sender or to the user, never confuse them.`;
+ default:
+ return `Conversation session ${on}`;
+ }
+}
+
+/** Message headings are trusted only in Room Raw, which escapes them in
+ * bodies; mail, notes and transcripts keep their source date. */
+function roomMessageAt(
+ source: Pick<FactSource, "origin_kind" | "content">,
+ offset: number,
+) {
+ return source.origin_kind === "room"
+ ? messageAt(source.content, offset)
+ : undefined;
+}
+
/** Hindsight's Event Date: the first message time of the window, else the source date. */
function eventDate(
- content: string,
+ source: Pick<FactSource, "origin_kind" | "content" | "date">,
window: FactWindow,
- date: string | null,
): Date | undefined {
- const at = messageAt(content, window.chunks[0]!.start + 1)?.mentionedAt;
- const value = at ?? (date ? `${date}T00:00:00Z` : undefined);
+ const at = roomMessageAt(source, window.chunks[0]!.start + 1)?.mentionedAt;
+ const value = at ?? (source.date ? `${source.date}T00:00:00Z` : undefined);
return value ? new Date(value) : undefined;
}
diff --git a/apps/node-services/tests/memory/session-fact-index.test.ts b/apps/node-services/tests/memory/session-fact-index.test.ts
index 121ed51e..ed270ffd 100644
--- a/apps/node-services/tests/memory/session-fact-index.test.ts
+++ b/apps/node-services/tests/memory/session-fact-index.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import {
factChunk,
+ factContext,
messageAt,
sessionFactText,
} from "../../src/memory/session-fact-index.js";
@@ -26,6 +27,36 @@ describe("Session fact binding", () => {
});
});
+describe("Session fact context", () => {
+ it("tells the extraction what kind of text each origin is", () => {
+ const at = { date: "2026-09-29", mail_class: null, replied: false };
+ expect(factContext({ ...at, origin_kind: "room" })).toBe(
+ "Conversation session on 2026-09-29",
+ );
+ expect(factContext({ ...at, origin_kind: "recording" })).toMatch(
+ /^Meeting recording transcript on 2026-09-29.*Speakers may be unlabeled/u,
+ );
+ expect(factContext({ ...at, origin_kind: "pocket_note" })).toBe(
+ "The user's own Pocket Note on 2026-09-29.",
+ );
+ const mail = { ...at, origin_kind: "mail" };
+ expect(factContext({ ...mail, mail_class: "direct_inbound" })).toMatch(
+ /^Email on 2026-09-29.*Attribute each fact/u,
+ );
+ // A notification may hold nothing worth keeping, unless the Human replied.
+ expect(factContext({ ...mail, mail_class: "system_notification" })).toMatch(
+ /^Automated email.*return none\.$/u,
+ );
+ expect(
+ factContext({
+ ...mail,
+ mail_class: "system_notification",
+ replied: true,
+ }),
+ ).toMatch(/^Email on/u);
+ });
+});
+
describe("Session fact chunk", () => {
it("binds a fact to the window chunk sharing the most terms", () => {
const chunk = (id: string, content: string) => ({
diff --git a/apps/node-services/tests/memory/session-facts.postgres.test.ts b/apps/node-services/tests/memory/session-facts.postgres.test.ts
index 23408898..b2124d35 100644
--- a/apps/node-services/tests/memory/session-facts.postgres.test.ts
+++ b/apps/node-services/tests/memory/session-facts.postgres.test.ts
@@ -13,7 +13,10 @@ import {
} from "vitest";
import { MemoryChunkIndex } from "../../src/memory/chunk-index.js";
import { searchRawSources } from "../../src/memory/search/raw-query.js";
-import { storePocketNoteSource } from "../../src/memory/search/source-store.js";
+import {
+ documentRawSource,
+ storePocketNoteSource,
+} from "../../src/memory/search/source-store.js";
import { SessionFactIndex } from "../../src/memory/session-fact-index.js";
import type { ExtractedFact } from "../../src/memory/session-fact-extraction.js";
import { readTimelineEvents } from "../../src/memory/graph-visualization.js";
@@ -69,7 +72,6 @@ describe.runIf(Boolean(databaseUrl))("Session facts in PostgreSQL", () => {
extracted.length = 0;
facts = new SessionFactIndex({
sql: indexSql,
- sourceUris: "%",
// Stand-in for the Hindsight-prompt model call, keyed on window text.
extract: async (batch) =>
new Map(
@@ -116,9 +118,13 @@ describe.runIf(Boolean(databaseUrl))("Session facts in PostgreSQL", () => {
markdown,
);
}
+ // The fixtures are Room transcripts staged through the Pocket Note store;
+ // marked Room so their message headings date and attribute facts.
async function publishRaw(markdown: string) {
await stageRaw(identity, markdown);
await chunks.syncAgent(identity.agent_id);
+ await sql`UPDATE memory_index.sources SET origin_kind = 'room'
+ WHERE agent_id = ${identity.agent_id} AND origin_kind = 'pocket_note'`;
}
const shoes = {
what: "User cleaned white Adidas sneakers in April 2026",
@@ -284,7 +290,6 @@ describe.runIf(Boolean(databaseUrl))("Session facts in PostgreSQL", () => {
const owners: unknown[] = [];
const batched = new SessionFactIndex({
sql: indexSql,
- sourceUris: "%",
extract: async (batch, owner) => {
batches.push(batch.length);
owners.push(owner);
@@ -335,4 +340,50 @@ describe.runIf(Boolean(databaseUrl))("Session facts in PostgreSQL", () => {
shoesText,
]);
});
+ it("extracts mail by class and whole threads the Human replied to", async () => {
+ const mail = async (
+ id: string,
+ cls: string,
+ thread: string,
+ extra = "",
+ ) => {
+ const markdown = `# ${id}\n\n- Provider: gmail\n- Message ID: \`${id}\`\n- Thread ID: \`${thread}\`\n- Timestamp: 2026-05-24T01:00:00Z\n- Direction: inbound\n- From: [email protected]\n- To: [email protected]\n- Cc: \n- Class: ${cls}\n\nBody of ${id}.\n${extra}`;
+ const source = documentRawSource({
+ identity,
+ documentId: `document_${id}`,
+ textSourceKind: "file_version",
+ textSourceId: `version_${id}`,
+ title: id,
+ filename: `${id}.md`,
+ mediaType: "text/markdown",
+ originKind: "mail",
+ date: "2026-05-24",
+ markdown,
+ });
+ await chunks.indexDatabaseSource(source, markdown);
+ };
+ // A body line shaped like a Room message heading must not date the fact.
+ await mail(
+ "person",
+ "direct_inbound",
+ "t1",
+ "\n## 2030-01-01T00:00:00.000Z · Alice\n\nI cleaned my white Adidas.\n",
+ );
+ await mail("notice", "system_notification", "t2");
+ await mail("promo", "marketing", "t3");
+ await mail("digest", "subscription", "t4");
+ await mail("sent", "self_sent", "t4");
+ await facts.syncAgent(identity.agent_id);
+ const bodies = extracted.map((text) => text.match(/Body of (\w+)/u)?.[1]);
+ // The digest joins because the Human replied in its thread; the promotion stays chunk-only.
+ expect(bodies.sort()).toEqual(["digest", "notice", "person", "sent"]);
+ const [stored] = await sql<
+ { mentioned_at: Date; speaker: string | null }[]
+ >`
+ SELECT mentioned_at, speaker FROM memory_index.session_facts`;
+ expect(stored).toEqual({
+ mentioned_at: new Date("2026-05-24T00:00:00Z"),
+ speaker: null,
+ });
+ });
});
diff --git a/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap b/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap
index 7fa1dbf0..878cba3b 100644
--- a/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap
+++ b/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap
@@ -1790,7 +1790,7 @@ Options:
--schema Show offline input and output schemas.
",
"schema": "exit 0
-{"command":["knowledge","search"],"description":"Search every source of authorized knowledge; each result names its source kind.","read_only":true,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":10000,"description":"The distinctive phrase, entity, or term being asked about, keeping the current request's named project, person, or event. Do not add unrelated topics from earlier turns. When the question names a time, such as last weekend, in 2023, or last month, keep those words in the query and put the resolved dates in eventFrom/eventTo; leave them unset when the question names no time, even when the request carries a date."},"alternates":{"description":"Up to six synonyms, translations (Chinese and English) or related terms the evidence may use instead of the query's words. Each is searched separately beside the query; always pass some when the query is a single wording.","maxItems":6,"type":"array","items":{"type":"string","minLength":1,"maxLength":200,"description":"One synonym, translation or related term."}},"dateFrom":{"description":"Optional start of the period the question is about, such as when sources were recorded. It only ranks sources and facts from that period higher and never excludes other dates, so leave it unset unless the question names a period.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"dateTo":{"description":"Optional end of the period the question is about; pair with dateFrom. It only ranks results and never excludes other dates.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"eventFrom":{"description":"Inclusive start of when the asked event happened, such as 2026-04-01 for what the Human did last month. It ranks facts and sources from that period higher and never excludes others; it takes precedence over dateFrom/dateTo. Leave unset when the question does not ask about a time.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"eventTo":{"description":"Inclusive end of when the asked event happened; pair with eventFrom. Never a source-date filter.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"}},"required":["query"],"additionalProperties":false,"description":"Question for one search over every source of the Human's knowledge: Sessions, recordings, My pages, mail, Pocket Notes, the Profile, the published Wiki and Daily and Weekly reports."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"schemaVersion":{"type":"integer","const":2},"status":{"type":"string","enum":["grounded","partial","empty"],"description":"Candidate retrieval status, not the sufficiency of unread bodies."},"items":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"citeAs":{"type":"string","pattern":"^S[1-9][0-9]*$","description":"Citation label assigned for this result."},"title":{"type":"string","minLength":1,"maxLength":512,"description":"Evidence title."},"excerpt":{"type":"string","minLength":1,"maxLength":600,"description":"Short preview of the matched original-source chunk."},"content":{"description":"Bounded matched chunk text for top-ranked candidates; several chunks are joined in document order with an ellipsis. A trailing ellipsis can indicate truncation. If a required fact is missing, read the returned directory section IDs; content presence does not mean the source is complete.","type":"string","maxLength":6000},"source":{"type":"object","properties":{"kind":{"type":"string","minLength":1,"maxLength":64,"description":"Where the source came from: room, recording, my_pages, mail, pocket_note, profile, wiki or period_summary."},"ref":{"type":"string","minLength":1,"maxLength":1024,"description":"Opaque source reference; not a user-facing label."},"label":{"description":"Source label.","type":"string","minLength":1,"maxLength":512}},"required":["kind","ref"],"additionalProperties":false,"description":"Evidence origin."},"representation":{"type":"string","enum":["source_excerpt","derived_summary","structured_fact"],"description":"Whether the evidence is source text, a summary, or a fact."},"facet":{"description":"Extensible semantic facet.","type":"string","minLength":1,"maxLength":128},"timeHint":{"description":"Time associated with this evidence when available.","type":"string","minLength":1,"maxLength":128},"metadata":{"description":"Small primitive metadata map.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string","maxLength":512,"description":"Metadata text value."},{"type":"number","description":"Metadata numeric value."},{"type":"boolean","description":"Metadata boolean value."},{"type":"null","description":"Metadata null value."}],"description":"Primitive evidence metadata value."}},"directory":{"description":"Available Markdown headings for a follow-up evidence read.","maxItems":64,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":512,"description":"Markdown section title."},"level":{"type":"integer","minimum":1,"maximum":6,"description":"Markdown heading level."},"purpose":{"description":"Directory guidance, never evidence content.","type":"string","minLength":1,"maxLength":512},"sectionId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9_-]*$","description":"Stable section identifier within one evidence item."}},"required":["sectionId","title","level"],"additionalProperties":false,"description":"One available Markdown section for follow-up evidence reading."}},"evidenceId":{"type":"string","pattern":"^raw_[a-f0-9]{16}_[a-f0-9]{16}$","description":"Opaque raw_... candidate ID; pass it unchanged to teamhub knowledge read."}},"required":["evidenceId","citeAs","title","excerpt","source","representation"],"additionalProperties":false,"description":"One bounded piece of evidence for the Agent to synthesize."},"description":"Candidates ordered to match their S1...Sn labels; read relevant sections next."},"gaps":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64,"description":"Extensible stable gap code."},"detail":{"description":"Optional safe detail about the evidence gap.","type":"string","minLength":1,"maxLength":512}},"required":["code"],"additionalProperties":false,"description":"One reason the retrieved evidence does not cover the query."},"description":"evidence_sections_not_read requires relevant reads before judging that information is missing."},"indexedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"Newest source snapshot time."},{"type":"null","description":"No source snapshot is available."}],"description":"Time of the newest source snapshot queried, when available."},"facts":{"description":"Matched Session facts, ranked apart from items. They pinpoint details and event times; read the named source section when the answer depends on exact wording.","maxItems":30,"type":"array","items":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":1000,"description":"The fact: what | When: ... | Involving: ... | why."},"factType":{"type":"string","enum":["world","assistant"],"description":"assistant marks what the agent did or suggested, not the Human."},"entities":{"description":"People, places and things the fact names.","maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":80,"description":"Entity name."}},"occurredStart":{"description":"When the event began.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"occurredEnd":{"description":"When the event ended.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"mentionedAt":{"type":"string","minLength":1,"maxLength":64,"description":"When the source message said it."},"evidenceId":{"type":"string","pattern":"^raw_[a-f0-9]{16}_[a-f0-9]{16}$","description":"Opaque raw_... candidate ID; pass it unchanged to teamhub knowledge read."},"sectionId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9_-]*$","description":"Source section stating the fact; read it with evidenceId for the original wording."}},"required":["text","factType","mentionedAt","evidenceId","sectionId"],"additionalProperties":false,"description":"A fact extracted from a Room conversation, located in one source section."}},"requestId":{"description":"Optional query trace identifier.","type":"string","minLength":1,"maxLength":128}},"required":["schemaVersion","status","items","gaps","indexedAt"],"additionalProperties":false,"description":"Candidate routing hints; do not conclude information is insufficient before reading relevant available sections."},"cli":{"usage":["teamhub knowledge search [flags]"],"arguments":["<query>"],"options":{"--alternate":{"description":"Synonym, translation or related term searched beside the query; up to 6.","repeatable":true},"--date-from":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--date-to":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--event-from":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--event-to":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":[]}}
+{"command":["knowledge","search"],"description":"Search every source of authorized knowledge; each result names its source kind.","read_only":true,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":10000,"description":"The distinctive phrase, entity, or term being asked about, keeping the current request's named project, person, or event. Do not add unrelated topics from earlier turns. When the question names a time, such as last weekend, in 2023, or last month, keep those words in the query and put the resolved dates in eventFrom/eventTo; leave them unset when the question names no time, even when the request carries a date."},"alternates":{"description":"Up to six synonyms, translations (Chinese and English) or related terms the evidence may use instead of the query's words. Each is searched separately beside the query; always pass some when the query is a single wording.","maxItems":6,"type":"array","items":{"type":"string","minLength":1,"maxLength":200,"description":"One synonym, translation or related term."}},"dateFrom":{"description":"Optional start of the period the question is about, such as when sources were recorded. It only ranks sources and facts from that period higher and never excludes other dates, so leave it unset unless the question names a period.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"dateTo":{"description":"Optional end of the period the question is about; pair with dateFrom. It only ranks results and never excludes other dates.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"eventFrom":{"description":"Inclusive start of when the asked event happened, such as 2026-04-01 for what the Human did last month. It ranks facts and sources from that period higher and never excludes others; it takes precedence over dateFrom/dateTo. Leave unset when the question does not ask about a time.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"eventTo":{"description":"Inclusive end of when the asked event happened; pair with eventFrom. Never a source-date filter.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"}},"required":["query"],"additionalProperties":false,"description":"Question for one search over every source of the Human's knowledge: Sessions, recordings, My pages, mail, Pocket Notes, the Profile, the published Wiki and Daily and Weekly reports."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"schemaVersion":{"type":"integer","const":2},"status":{"type":"string","enum":["grounded","partial","empty"],"description":"Candidate retrieval status, not the sufficiency of unread bodies."},"items":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"citeAs":{"type":"string","pattern":"^S[1-9][0-9]*$","description":"Citation label assigned for this result."},"title":{"type":"string","minLength":1,"maxLength":512,"description":"Evidence title."},"excerpt":{"type":"string","minLength":1,"maxLength":600,"description":"Short preview of the matched original-source chunk."},"content":{"description":"Bounded matched chunk text for top-ranked candidates; several chunks are joined in document order with an ellipsis. A trailing ellipsis can indicate truncation. If a required fact is missing, read the returned directory section IDs; content presence does not mean the source is complete.","type":"string","maxLength":6000},"source":{"type":"object","properties":{"kind":{"type":"string","minLength":1,"maxLength":64,"description":"Where the source came from: room, recording, my_pages, mail, pocket_note, profile, wiki or period_summary."},"ref":{"type":"string","minLength":1,"maxLength":1024,"description":"Opaque source reference; not a user-facing label."},"label":{"description":"Source label.","type":"string","minLength":1,"maxLength":512}},"required":["kind","ref"],"additionalProperties":false,"description":"Evidence origin."},"representation":{"type":"string","enum":["source_excerpt","derived_summary","structured_fact"],"description":"Whether the evidence is source text, a summary, or a fact."},"facet":{"description":"Extensible semantic facet.","type":"string","minLength":1,"maxLength":128},"timeHint":{"description":"Time associated with this evidence when available.","type":"string","minLength":1,"maxLength":128},"metadata":{"description":"Small primitive metadata map.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string","maxLength":512,"description":"Metadata text value."},{"type":"number","description":"Metadata numeric value."},{"type":"boolean","description":"Metadata boolean value."},{"type":"null","description":"Metadata null value."}],"description":"Primitive evidence metadata value."}},"directory":{"description":"Available Markdown headings for a follow-up evidence read.","maxItems":64,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":512,"description":"Markdown section title."},"level":{"type":"integer","minimum":1,"maximum":6,"description":"Markdown heading level."},"purpose":{"description":"Directory guidance, never evidence content.","type":"string","minLength":1,"maxLength":512},"sectionId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9_-]*$","description":"Stable section identifier within one evidence item."}},"required":["sectionId","title","level"],"additionalProperties":false,"description":"One available Markdown section for follow-up evidence reading."}},"evidenceId":{"type":"string","pattern":"^raw_[a-f0-9]{16}_[a-f0-9]{16}$","description":"Opaque raw_... candidate ID; pass it unchanged to teamhub knowledge read."}},"required":["evidenceId","citeAs","title","excerpt","source","representation"],"additionalProperties":false,"description":"One bounded piece of evidence for the Agent to synthesize."},"description":"Candidates ordered to match their S1...Sn labels; read relevant sections next."},"gaps":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64,"description":"Extensible stable gap code."},"detail":{"description":"Optional safe detail about the evidence gap.","type":"string","minLength":1,"maxLength":512}},"required":["code"],"additionalProperties":false,"description":"One reason the retrieved evidence does not cover the query."},"description":"evidence_sections_not_read requires relevant reads before judging that information is missing."},"indexedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"Newest source snapshot time."},{"type":"null","description":"No source snapshot is available."}],"description":"Time of the newest source snapshot queried, when available."},"facts":{"description":"Matched Session facts, ranked apart from items. They pinpoint details and event times; read the named source section when the answer depends on exact wording.","maxItems":30,"type":"array","items":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":1000,"description":"The fact: what | When: ... | Involving: ... | why."},"factType":{"type":"string","enum":["world","assistant"],"description":"assistant marks what the agent did or suggested, not the Human."},"entities":{"description":"People, places and things the fact names.","maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":80,"description":"Entity name."}},"occurredStart":{"description":"When the event began.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"occurredEnd":{"description":"When the event ended.","type":"string","format":"date","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))$"},"mentionedAt":{"type":"string","minLength":1,"maxLength":64,"description":"When the source message said it."},"evidenceId":{"type":"string","pattern":"^raw_[a-f0-9]{16}_[a-f0-9]{16}$","description":"Opaque raw_... candidate ID; pass it unchanged to teamhub knowledge read."},"sectionId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9_-]*$","description":"Source section stating the fact; read it with evidenceId for the original wording."}},"required":["text","factType","mentionedAt","evidenceId","sectionId"],"additionalProperties":false,"description":"A fact extracted from a conversation, recording, Pocket Note or email, located in one source section."}},"requestId":{"description":"Optional query trace identifier.","type":"string","minLength":1,"maxLength":128}},"required":["schemaVersion","status","items","gaps","indexedAt"],"additionalProperties":false,"description":"Candidate routing hints; do not conclude information is insufficient before reading relevant available sections."},"cli":{"usage":["teamhub knowledge search [flags]"],"arguments":["<query>"],"options":{"--alternate":{"description":"Synonym, translation or related term searched beside the query; up to 6.","repeatable":true},"--date-from":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--date-to":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--event-from":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--event-to":{"description":"YYYY-MM-DD ranking preference; other dates may appear."},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":[]}}
",
},
"message ask-user": {
diff --git a/apps/teamhub-cli/src/domains/knowledge/tools/query.ts b/apps/teamhub-cli/src/domains/knowledge/tools/query.ts
index 959f5406..3eaa4d54 100644
--- a/apps/teamhub-cli/src/domains/knowledge/tools/query.ts
+++ b/apps/teamhub-cli/src/domains/knowledge/tools/query.ts
@@ -153,7 +153,7 @@ export const sessionFactSchema = z
})
.strict()
.describe(
- "A fact extracted from a Room conversation, located in one source section.",
+ "A fact extracted from a conversation, recording, Pocket Note or email, located in one source section.",
);
const evidenceItemSchema = z
diff --git a/apps/teamhub/internal/composio/mail_import.go b/apps/teamhub/internal/composio/mail_import.go
index 0fc4e93d..ddc6c44e 100644
--- a/apps/teamhub/internal/composio/mail_import.go
+++ b/apps/teamhub/internal/composio/mail_import.go
@@ -328,8 +328,15 @@ func (c *Client) renderImportedMail(provider string, message gmailMessage) (AppD
if err != nil {
return AppDocument{}, err
}
- automated := emailevidence.AutomatedClass(gmailMessageSignals(message))
+ signals := gmailMessageSignals(message)
+ automated := emailevidence.AutomatedClass(signals)
+ class, err := emailevidence.ClassOf(emailevidence.Direction(gmailMessageDirectionValue(message)), signals)
+ if err != nil {
+ return AppDocument{}, err
+ }
profile := profileMailView(output.String(), withoutLinkTracking(authored), body, automated, gmailMessageDirectionValue(message) == "outbound")
+ // Memory decides from the class which mail it extracts Session facts from.
+ fmt.Fprintf(&output, "- Class: %s\n", class)
output.WriteString("\n" + body + "\n")
payload := gmailThreadPayload{ID: message.ThreadID, Messages: []gmailMessage{message}}
if payload.ID == "" {
diff --git a/apps/teamhub/internal/composio/mail_import_test.go b/apps/teamhub/internal/composio/mail_import_test.go
index 26701049..cdb317f5 100644
--- a/apps/teamhub/internal/composio/mail_import_test.go
+++ b/apps/teamhub/internal/composio/mail_import_test.go
@@ -195,7 +195,8 @@ func TestRenderImportedMailProfileViewMarksQuotesAndAutomatedMail(t *testing.T)
}
authored := authoredProfileSections(profile)
if !strings.Contains(profile, "## Written by the sender of this message") || strings.Contains(authored, "Quoted history line") ||
- !strings.Contains(profile, "Quoted history line") || !strings.Contains(full, "Quoted history line") || document.Automated {
+ !strings.Contains(profile, "Quoted history line") || !strings.Contains(full, "Quoted history line") || document.Automated ||
+ !strings.Contains(full, "- Cc: \n- Class: direct_inbound\n\n") || strings.Contains(profile, "- Class:") {
t.Fatalf("profile=%s\nmarkdown=%s", profile, full)
}
promotions := map[string]string{"Subject": "Sale", "From": "Shop <[email protected]>"}
@@ -213,7 +214,7 @@ func TestRenderImportedMailProfileViewMarksQuotesAndAutomatedMail(t *testing.T)
}
profile := string(document.ProfileMarkdown)
if !document.Automated || !strings.Contains(profile, "- Kind: automated (marketing)") || authoredProfileSections(profile) != "" ||
- !strings.Contains(profile, test.body) || len(document.Markdown) == 0 {
+ !strings.Contains(profile, test.body) || !strings.Contains(string(document.Markdown), "- Class: marketing\n") {
t.Fatalf("%s: profile=%q markdown=%q", name, document.ProfileMarkdown, document.Markdown)
}
}
@@ -221,7 +222,8 @@ func TestRenderImportedMailProfileViewMarksQuotesAndAutomatedMail(t *testing.T)
if err != nil {
t.Fatal(err)
}
- if !strings.Contains(string(sent.ProfileMarkdown), "## Written by the subject in this message\n\nHere is my plan.") {
+ if !strings.Contains(string(sent.ProfileMarkdown), "## Written by the subject in this message\n\nHere is my plan.") ||
+ !strings.Contains(string(sent.Markdown), "- Class: self_sent\n") {
t.Fatalf("sent profile=%s", sent.ProfileMarkdown)
}
}
diff --git a/apps/teamhub/internal/emailevidence/classifier.go b/apps/teamhub/internal/emailevidence/classifier.go
index 6d201159..931706a7 100644
--- a/apps/teamhub/internal/emailevidence/classifier.go
+++ b/apps/teamhub/internal/emailevidence/classifier.go
@@ -53,6 +53,11 @@ func Classify(inputs []MessageInput) ([]ClassifiedMessage, error) {
return classified, nil
}
+// ClassOf classifies one message from its direction and structural signals.
+func ClassOf(direction Direction, signals Signals) (MessageClass, error) {
+ return classifyMessage(MessageInput{Direction: direction, Signals: signals})
+}
+
func classifyMessage(input MessageInput) (MessageClass, error) {
switch input.Direction {
case DirectionDraft:
diff --git a/contracts/generated/go/nodeservicesinternal/openapi.gen.go b/contracts/generated/go/nodeservicesinternal/openapi.gen.go
index 28ea0332..f0330cc7 100644
--- a/contracts/generated/go/nodeservicesinternal/openapi.gen.go
+++ b/contracts/generated/go/nodeservicesinternal/openapi.gen.go
@@ -2009,7 +2009,7 @@ type PersonalKnowledgeQueryRequest struct {
// PersonalKnowledgeQueryResponse defines model for PersonalKnowledgeQueryResponse.
type PersonalKnowledgeQueryResponse struct {
- // Facts Session facts extracted from Room conversations that matched the query, ranked separately from items so they never displace Raw candidates. Each names the Raw chunk that states it; that chunk remains the original evidence.
+ // Facts Session facts extracted from conversations, recordings, Pocket Notes and personal mail that matched the query, ranked separately from items so they never displace Raw candidates. Each names the Raw chunk that states it; that chunk remains the original evidence.
Facts *[]PersonalKnowledgeSessionFact `json:"facts,omitempty"`
Gaps []PersonalKnowledgeEvidenceGap `json:"gaps"`
IndexedAt *time.Time `json:"indexedAt"`
diff --git a/contracts/generated/typescript/src/generated/node-services-internal/types.ts b/contracts/generated/typescript/src/generated/node-services-internal/types.ts
index b2b7b51e..9a41a12e 100644
--- a/contracts/generated/typescript/src/generated/node-services-internal/types.ts
+++ b/contracts/generated/typescript/src/generated/node-services-internal/types.ts
@@ -788,7 +788,7 @@ export interface components {
gaps: components["schemas"]["PersonalKnowledgeEvidenceGap"][];
/** Format: date-time */
indexedAt: string | null;
- /** @description Session facts extracted from Room conversations that matched the query, ranked separately from items so they never displace Raw candidates. Each names the Raw chunk that states it; that chunk remains the original evidence. */
+ /** @description Session facts extracted from conversations, recordings, Pocket Notes and personal mail that matched the query, ranked separately from items so they never displace Raw candidates. Each names the Raw chunk that states it; that chunk remains the original evidence. */
facts?: components["schemas"]["PersonalKnowledgeSessionFact"][];
requestId?: string;
};
diff --git a/contracts/openapi/node-services-internal/openapi.yaml b/contracts/openapi/node-services-internal/openapi.yaml
index 3a718be0..ec68bb7f 100644
--- a/contracts/openapi/node-services-internal/openapi.yaml
+++ b/contracts/openapi/node-services-internal/openapi.yaml
@@ -1690,9 +1690,9 @@ components:
type: array
maxItems: 30
description:
- Session facts extracted from Room conversations that matched the
- query, ranked separately from items so they never displace Raw
- candidates. Each names the Raw chunk that states it; that chunk
+ Session facts extracted from conversations, recordings, Pocket
+ Notes and personal mail that matched the query, ranked separately
+ from items so they never displace Raw candidates. Each names the Raw chunk that states it; that chunk
remains the original evidence.
items:
$ref: "#/components/schemas/PersonalKnowledgeSessionFact"
diff --git a/docs/wiki-and-memory.md b/docs/wiki-and-memory.md
index 210f8f42..ffd5908b 100644
--- a/docs/wiki-and-memory.md
+++ b/docs/wiki-and-memory.md
@@ -61,7 +61,7 @@ originals before it says something was never recorded.
| Keywords | PostgreSQL full-text search, once for the query and once for each alternate wording | Same |
| Time | | Keyword matches inside a time window the question names |
| Fusion | Reciprocal rank fusion of all lists | Same |
-| Extra | | Facts extracted from conversations, returned as their own list |
+| Extra | | A separate list of facts from chats, recordings, notes, emails |
| Result | Ranked previews; the agent reads the section it needs | Ranked passages with neighboring sections to read next |
<sub>Agents pass up to six alternate wordings, such as synonyms and