Skip to content

Commit a37e581

Browse files
Search notes for unattached chat questions
Guide chat to search local meeting notes for open-ended factual questions when no context is attached.
1 parent 23a78f4 commit a37e581

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

apps/desktop/src/chat/tools/search-sessions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export const buildSearchSessionsTool = (deps: ToolDependencies) =>
105105
tool({
106106
description: `
107107
Search for sessions (meeting notes) using query and filters.
108+
Use this first for open-ended questions about past meetings, people, decisions, or topics when the answer may be in meeting notes and no specific note is attached.
108109
Use filters.created_at.kind="relative" with recent_days for natural-language date ranges.
109110
Use an empty query string when the user only wants sessions by date/time filter.
110111
Returns relevant sessions with their content.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { describe, expect, it } from "vitest";
2+
3+
import { appendFileContextToolGuidance } from "./use-transport";
4+
5+
describe("chat transport prompt guidance", () => {
6+
it("tells chat to search meeting notes when no context is attached", () => {
7+
const prompt = appendFileContextToolGuidance("Base prompt");
8+
9+
expect(prompt).toContain("Base prompt");
10+
expect(prompt).toContain("When no context is attached");
11+
expect(prompt).toContain("use search_sessions");
12+
expect(prompt).toContain(
13+
"Do not ask the user to open or share a meeting note",
14+
);
15+
});
16+
});

apps/desktop/src/chat/transport/use-transport.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ import { useToolRegistry } from "~/contexts/tool";
1313
import { useConfigValue } from "~/shared/config";
1414
import * as main from "~/store/tinybase/store/main";
1515

16-
const FILE_CONTEXT_TOOL_GUIDANCE = `
16+
export const FILE_CONTEXT_TOOL_GUIDANCE = `
1717
Context and local-note tool guidance:
18+
- When no context is attached and the user asks a factual question that could be answered by meeting notes, use search_sessions with the key names, topics, and date hints before answering. If the result looks relevant, answer from the returned meeting context or call read_note with the returned session id for more detail.
1819
- When the user asks about "this note", "this meeting", "the current note", or pronouns that likely refer to the open note, use read_current_note before answering.
19-
- When the user asks to find or search for something in notes, use grep_notes. If the answer needs the full source after a match, use read_note with the returned session id.
20+
- When the user asks to find or search for exact wording in notes, use grep_notes. If the answer needs the full source after a match, use read_note with the returned session id.
2021
- When the user asks about people from the current note or related meetings, use list_related_notes and then read_note as needed.
22+
- Do not ask the user to open or share a meeting note until search_sessions, grep_notes, or read_note cannot find enough local context.
2123
- Do not assume note contents from chat history when a file-backed tool can read the current source of truth.
2224
2325
Web search guidance:
@@ -26,7 +28,7 @@ Web search guidance:
2628
- Do not use web_search for questions that only need local notes, contacts, or calendar events.
2729
`.trim();
2830

29-
function appendFileContextToolGuidance(
31+
export function appendFileContextToolGuidance(
3032
prompt: string | undefined,
3133
): string | undefined {
3234
if (prompt === undefined) {

0 commit comments

Comments
 (0)