Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/chat/tools/note-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export const buildReadNoteTool = (deps: ToolDependencies) =>
export const buildGrepNotesTool = (deps: ToolDependencies) =>
tool({
description:
"Lexically search local note files and transcripts. Use this for find/search requests before answering from memory. This is filesystem-backed text search, not vector search.",
"Lexically search local note files and transcripts for exact words or phrases. Use search_sessions first for open-ended questions about past meetings, people, decisions, or topics. This is filesystem-backed text search, not vector search.",
inputSchema: z.object({
query: z.string().describe("Text to search for in note files"),
sessionIds: z
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/chat/tools/search-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const buildSearchSessionsTool = (deps: ToolDependencies) =>
tool({
description: `
Search for sessions (meeting notes) using query and filters.
Use this first for open-ended questions about past meetings, people, decisions, or topics when the answer may be in meeting notes and no meeting note context is attached.
Use filters.created_at.kind="relative" with recent_days for natural-language date ranges.
Use an empty query string when the user only wants sessions by date/time filter.
Returns relevant sessions with their content.
Expand Down
16 changes: 16 additions & 0 deletions apps/desktop/src/chat/transport/use-transport.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";

import { appendFileContextToolGuidance } from "./use-transport";

describe("chat transport prompt guidance", () => {
it("tells chat to search meeting notes when no meeting note context is attached", () => {
const prompt = appendFileContextToolGuidance("Base prompt");

expect(prompt).toContain("Base prompt");
expect(prompt).toContain("When no meeting note context is attached");
expect(prompt).toContain("use search_sessions");
expect(prompt).toContain(
"Do not ask the user to open or share a meeting note",
);
});
});
8 changes: 5 additions & 3 deletions apps/desktop/src/chat/transport/use-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import { useToolRegistry } from "~/contexts/tool";
import { useConfigValue } from "~/shared/config";
import * as main from "~/store/tinybase/store/main";

const FILE_CONTEXT_TOOL_GUIDANCE = `
export const FILE_CONTEXT_TOOL_GUIDANCE = `
Context and local-note tool guidance:
- When no meeting note 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.
- 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.
- 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.
- 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.
Comment thread
cursor[bot] marked this conversation as resolved.
- When the user asks about people from the current note or related meetings, use list_related_notes and then read_note as needed.
- 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.
- Do not assume note contents from chat history when a file-backed tool can read the current source of truth.

Web search guidance:
Expand All @@ -26,7 +28,7 @@ Web search guidance:
- Do not use web_search for questions that only need local notes, contacts, or calendar events.
`.trim();

function appendFileContextToolGuidance(
export function appendFileContextToolGuidance(
prompt: string | undefined,
): string | undefined {
if (prompt === undefined) {
Expand Down
Loading