Skip to content

Commit b50ad42

Browse files
committed
Polish agent prompts and fix wrong language instruction
Three related touch-ups to the three agent prompts: - Fix a copy-paste bug where the Q&A and lint agents were told to "Write all wiki content in X language" — the Q&A agent doesn't write wiki content, and the lint agent writes reports. Switch them to "Answer in X" and "Write the lint report in X" respectively. The compiler agent keeps its original wording since it actually writes wiki content. - Give all three agents an OpenKB identity in their opening line so the model introduces itself consistently when asked who it is. - In the Q&A search strategy, finish the thought on summaries (tell the model to follow the `full_text` path when a summary is too thin), trim step 5 so the get_image tool's "when to call" guidance lives in the tool docstring instead of the instructions template, and reword step 5 to refer to the tool by name with "the ... tool".
1 parent b723ae9 commit b50ad42

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

openkb/agent/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# ---------------------------------------------------------------------------
3131

3232
_SYSTEM_TEMPLATE = """\
33-
You are a wiki compilation agent for a personal knowledge base.
33+
You are OpenKB's wiki compilation agent for a personal knowledge base.
3434
3535
{schema_md}
3636

openkb/agent/linter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from openkb.schema import SCHEMA_MD, get_agents_md
1212

1313
_LINTER_INSTRUCTIONS_TEMPLATE = """\
14-
You are a knowledge-base semantic lint agent. Your job is to audit the wiki
14+
You are OpenKB's semantic lint agent. Your job is to audit the wiki
1515
for quality issues that structural tools cannot detect.
1616
1717
{schema_md}
@@ -50,7 +50,7 @@ def build_lint_agent(wiki_root: str, model: str, language: str = "en") -> Agent:
5050
"""
5151
schema_md = get_agents_md(Path(wiki_root))
5252
instructions = _LINTER_INSTRUCTIONS_TEMPLATE.format(schema_md=schema_md)
53-
instructions += f"\n\nIMPORTANT: Write all wiki content in {language} language."
53+
instructions += f"\n\nIMPORTANT: Write the lint report in {language} language."
5454

5555
@function_tool
5656
def list_files(directory: str) -> str:

openkb/agent/query.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@
1212
from openkb.schema import get_agents_md
1313

1414
_QUERY_INSTRUCTIONS_TEMPLATE = """\
15-
You are a knowledge-base Q&A agent. You answer questions by searching the wiki.
15+
You are OpenKB, a knowledge-base Q&A agent. You answer questions by searching the wiki.
1616
1717
{schema_md}
1818
1919
## Search strategy
2020
1. Read index.md to see all documents and concepts with brief summaries.
2121
Each document is marked (short) or (pageindex) to indicate its type.
2222
2. Read relevant summary pages (summaries/) for document overviews.
23-
Note: summaries may omit details.
23+
Summaries may omit details — if you need more, follow the summary's
24+
`full_text` frontmatter field to the source (see step 4).
2425
3. Read concept pages (concepts/) for cross-document synthesis.
2526
4. When you need detailed source document content, each summary page has a
2627
`full_text` frontmatter field with the path to the original document content:
2728
- Short documents (doc_type: short): read_file with that path.
2829
- PageIndex documents (doc_type: pageindex): use get_page_content(doc_name, pages)
2930
with tight page ranges. The summary shows document tree structure with page
3031
ranges to help you target. Never fetch the whole document.
31-
5. When source content references images (e.g. ![image](sources/images/doc/file.png)),
32-
use get_image to view them. Always view images when the question asks about
33-
a figure, chart, diagram, or visual content.
32+
5. Source content may reference images (e.g. ![image](sources/images/doc/file.png)).
33+
Use the get_image tool to view them when needed.
3434
6. Synthesize a clear, concise, well-cited answer grounded in wiki content.
3535
3636
Answer based only on wiki content. Be concise.
@@ -44,7 +44,7 @@ def build_query_agent(wiki_root: str, model: str, language: str = "en") -> Agent
4444
"""Build and return the Q&A agent."""
4545
schema_md = get_agents_md(Path(wiki_root))
4646
instructions = _QUERY_INSTRUCTIONS_TEMPLATE.format(schema_md=schema_md)
47-
instructions += f"\n\nIMPORTANT: Write all wiki content in {language} language."
47+
instructions += f"\n\nIMPORTANT: Answer in {language} language."
4848

4949
@function_tool
5050
def read_file(path: str) -> str:
@@ -69,7 +69,10 @@ def get_page_content_tool(doc_name: str, pages: str) -> str:
6969
@function_tool
7070
def get_image(image_path: str) -> ToolOutputImage | ToolOutputText:
7171
"""View an image from the wiki.
72-
Use when source content references images you need to see.
72+
73+
Use when a question asks about a specific figure, chart, or diagram
74+
you'd need to see to answer accurately.
75+
7376
Args:
7477
image_path: Image path relative to wiki root (e.g. 'sources/images/doc/p1_img1.png').
7578
"""

0 commit comments

Comments
 (0)