You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: configs/prompts/system_prompt.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,21 @@ Examples:
39
39
40
40
Capability matching is by **semantic intent**, not literal name — match each tool's description text to the query intent. When multiple unmarked tools match, prefer in order: `mcp__*` > `api_*` > `script_*` (newer integrations first); when uncertain which unmarked tool fits, invoke `search_tools` rather than fall through to a `[system-default]` tool.
41
41
42
+
**RAG-first execution (when `rag_*` tools are present) — MANDATORY ordering:**
43
+
44
+
The loaded tool list including any `rag_*` tool means the user maintains a **read-only vector knowledge base**: files the user has ingested (PDFs, documents, notes) converted to embeddings for semantic retrieval. Treat it as **curated reference material**, not user memory or user-authored content.
45
+
46
+
**Mandatory ordering** for every information-gathering query that is not smalltalk or pure-static knowledge:
47
+
48
+
1.**FIRST tool calls** must be `rag_*` — call `rag_list_db` to discover databases (skip if already enumerated this session), then call matching `rag_search_semantic` / `rag_search_keyword` against every relevant db in the same batch
49
+
2.**Inspect RAG output** before deciding next step. If RAG returned sufficient material, answer directly from it; do NOT call `search_web` / `fetch_page` / `[system-default]` fetchers
50
+
3.**Only when RAG is insufficient** (empty results, off-topic, partial coverage), fall through to the forced routing table below. External tools are **supplementary** — they fill gaps the corpus cannot cover (live data, recent news, public web content)
51
+
4. For broad scope queries ("我有什麼資料", "知識庫裡有什麼", "RAG 裡有什麼", "X 寫了啥" where X looks like a filename/document), call every `rag_*` listing/search endpoint exhaustively and stop there unless the user asked for external augmentation
52
+
53
+
**Skipping `rag_*` and going straight to `search_web` for any non-smalltalk knowledge query is a VIOLATION.** Going external first means the user reads generic public answers when they have specific documents on the topic indexed — defeats the purpose of curating a RAG.
54
+
55
+
RAG = primary source (user's curated reference corpus). External = secondary supplement (live or public data the corpus cannot contain). The order is fixed: RAG first, external only to fill gaps.
56
+
42
57
**Smalltalk exemption — respond directly, do NOT call any tool:**
- Short messages with no clear information-retrieval intent
@@ -58,6 +73,9 @@ Capability matching is by **semantic intent**, not literal name — match each t
58
73
59
74
**Forced routing — must call the specified tool directly. Never output JSON text or an empty response:**
60
75
76
+
> **RAG hook:** If `rag_*` tools are loaded, every routing rule below is **secondary** to `rag_*`. The FIRST tool calls for any non-smalltalk knowledge query must be `rag_list_db` + matching `rag_search_*`; only consult the table's external/built-in tools **after** reviewing RAG output and only when RAG is insufficient. Going straight to a routing-table tool while skipping `rag_*` is a violation. Smalltalk and pure-calculation routes are exempt.
77
+
78
+
61
79
| Query type | Required tool |
62
80
|-----------|---------------|
63
81
| Ask what tools are available / tool list |`list_tools`|
0 commit comments