Skip to content

Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base

prompt improvements

Hugo Richard1a760a5303a1
diff --git a/apps/chat/app/components/ModelSelect.vue b/apps/chat/app/components/ModelSelect.vue
index 2d81acc..b4354e4 100644
--- a/apps/chat/app/components/ModelSelect.vue
+++ b/apps/chat/app/components/ModelSelect.vue
@@ -30,7 +30,8 @@ const items = computed(() => models.map(m => ({
value-key="value"
class="hover:bg-default focus:bg-default data-[state=open]:bg-default"
:ui="{
- trailingIcon: 'group-data-[state=open]:rotate-180 transition-transform duration-200'
+ trailingIcon: 'group-data-[state=open]:rotate-180 transition-transform duration-200',
+ content: 'w-auto min-w-max'
}"
/>
</template>
diff --git a/apps/chat/server/utils/bot/savoir.ts b/apps/chat/server/utils/bot/savoir.ts
index 2e03cdc..2150912 100644
--- a/apps/chat/server/utils/bot/savoir.ts
+++ b/apps/chat/server/utils/bot/savoir.ts
@@ -132,8 +132,8 @@ function createInternalBashBatchTool(onToolCall?: ToolCallCallback) {
return tool({
description: `Execute multiple bash commands in the documentation sandbox in a single request.
-More efficient than multiple single bash calls. Commands run sequentially.
-Use when you need to run several related commands (e.g., list + read multiple files).
+More efficient than multiple single bash calls — use this as your primary tool.
+Combine search (grep) and read (head/cat) commands in a single batch.
Maximum 10 commands per batch.`,
inputSchema: z.object({
commands: z.array(z.string()).min(1).max(10).describe('Array of bash commands to execute'),
diff --git a/apps/chat/server/utils/prompts/bot.ts b/apps/chat/server/utils/prompts/bot.ts
index ea5b98f..3f17c2e 100644
--- a/apps/chat/server/utils/prompts/bot.ts
+++ b/apps/chat/server/utils/prompts/bot.ts
@@ -11,32 +11,45 @@ ALWAYS search AND read the relevant documentation before responding. NEVER just
## Fast Search Strategy
-Use the fastest command for each task:
-
-| Task | Command | Why fast |
-|------|---------|----------|
-| Find files by content | \`grep -rl "keyword" docs/ --include="*.md" \\| head -5\` | \`-l\` stops at first match per file |
-| Find files by name | \`find docs/ -name "*routing*" -name "*.md"\` | Filesystem-level, no content read |
-| Read file (partial) | \`head -100 docs/path/file.md\` | Stops after N lines |
-| Read file (full) | \`cat docs/path/file.md\` | When you need everything |
-| Search with context | \`grep -n -C3 "keyword" docs/path/file.md\` | Line numbers + surrounding lines |
-| Directory overview | \`find docs/ -maxdepth 2 -type d\` | Fast tree view |
-
-## Workflow
-
-1. **Search**: \`grep -rl "term" docs/ --include="*.md" | head -5\`
-2. **Read** (use \`bash_batch\` for parallel reads): \`head -80 docs/path/file.md\`
-3. **Synthesize**: Provide a clear answer with code examples
-
-Chain with \`&&\` when sequential. Use \`bash_batch\` for independent reads.
-2–3 targeted commands beats 10 exploratory ones.
+ALWAYS prefer \`bash_batch\` over sequential \`bash\` calls. Combine search and read in the same batch.
+
+| Task | Command |
+|------|---------|
+| Find files by content | \`grep -rl "keyword" docs/ --include="*.md" \\| head -5\` |
+| Multi-keyword search | \`grep -rlE "term1\\|term2" docs/ --include="*.md" \\| head -5\` |
+| Find files by name | \`find docs/ -name "*routing*" -name "*.md"\` |
+| Read file (partial) | \`head -100 docs/path/file.md\` |
+| Read file (full) | \`cat docs/path/file.md\` |
+| Search with context | \`grep -n -C3 "keyword" docs/path/file.md\` |
+
+### Batch-first principle
+
+Use \`bash_batch\` to combine search AND read in a single call:
+\`\`\`
+bash_batch: [
+ "grep -rl \\"keyword\\" docs/source1/ --include=\\"*.md\\" | head -5",
+ "grep -rl \\"keyword\\" docs/source2/ --include=\\"*.md\\" | head -5",
+ "head -100 docs/source1/getting-started/index.md"
+]
+\`\`\`
+
+Use \`| head -N\` on all search output. Use \`grep -rlE "term1\\|term2"\` for multi-keyword search.
+1–2 batched calls beats 5 sequential ones.
**ALWAYS provide a text answer.** If you run out of relevant search results, answer with what you have. Never end on a tool call without a final response.
-## Good vs Bad Responses
+## Good vs Bad
+
+**Good** — 1-2 calls:
+1. \`bash_batch\`: grep across likely dirs + read obvious files in one call
+2. \`bash_batch\`: read remaining files from grep results
-**Good**: Search → read relevant files → concrete answer with code example from the docs.
-**Bad**: List directories → list subdirectories → read one file → vague summary without code.
+**Bad** — 5+ calls:
+1. \`find docs/ -maxdepth 2 -type d\`
+2. \`grep -rl "keyword" docs/source1/\`
+3. \`grep -rl "keyword" docs/source2/\`
+4. \`cat docs/source1/file1.md\`
+5. \`cat docs/source2/file2.md\`
## Response Style
diff --git a/apps/chat/server/utils/prompts/chat.ts b/apps/chat/server/utils/prompts/chat.ts
index d7c06d7..98b82e7 100644
--- a/apps/chat/server/utils/prompts/chat.ts
+++ b/apps/chat/server/utils/prompts/chat.ts
@@ -52,62 +52,50 @@ Your training data may be outdated. ONLY answer based on what you find in the so
## Fast Search Strategy
-Use the fastest command for each task. Minimize tool calls — batch when possible.
+ALWAYS prefer \`bash_batch\` over sequential \`bash\` calls. Combine search and read in the same batch.
-### 1. Discover structure (once per session)
-\`\`\`bash
-find docs/ -maxdepth 2 -type d
-\`\`\`
-
-### 2. Find files by content (fastest: grep -rl stops at first match per file)
-\`\`\`bash
-grep -rl "keyword" docs/ --include="*.md" | head -10
-\`\`\`
-
-### 3. Find files by name
-\`\`\`bash
-find docs/ -name "*routing*" -name "*.md"
-\`\`\`
-
-### 4. Read files
-\`\`\`bash
-head -100 docs/path/file.md # partial read (fast)
-cat docs/path/file.md # full read when needed
-\`\`\`
-
-### 5. Search with context (line numbers + surrounding lines)
-\`\`\`bash
-grep -n -C3 "keyword" docs/path/file.md
-\`\`\`
+### Quick reference
+| Task | Command |
+|------|---------|
+| Find files by content | \`grep -rl "keyword" docs/ --include="*.md" \\| head -5\` |
+| Multi-keyword search | \`grep -rlE "term1\\|term2" docs/ --include="*.md" \\| head -5\` |
+| Find files by name | \`find docs/ -name "*routing*" -name "*.md"\` |
+| Read file (partial) | \`head -100 docs/path/file.md\` |
+| Read file (full) | \`cat docs/path/file.md\` |
+| Search with context | \`grep -n -C3 "keyword" docs/path/file.md\` |
-## Batch Commands
+### Batch-first principle
-Use \`bash_batch\` to run multiple reads in parallel when you need several files:
+Use \`bash_batch\` to combine search AND read in a single call:
\`\`\`
-["head -80 docs/nuxt/1.getting-started/1.introduction.md", "head -80 docs/nuxt/1.getting-started/2.installation.md"]
+bash_batch: [
+ "grep -rl \\"keyword\\" docs/source1/ --include=\\"*.md\\" | head -5",
+ "grep -rl \\"keyword\\" docs/source2/ --include=\\"*.md\\" | head -5",
+ "head -100 docs/source1/getting-started/index.md"
+]
\`\`\`
-## Good vs Bad Examples
+### Good vs Bad
-**Good** — 2 calls, fast:
-1. \`grep -rl "useAsyncData" docs/nuxt --include="*.md" | head -5\`
-2. \`bash_batch\`: read the top results with \`head -80\`
+**Good** — 1-2 calls:
+1. \`bash_batch\`: grep across likely dirs + read obvious files in one call
+2. \`bash_batch\`: read remaining files from grep results
-**Bad** — slow, wasteful:
-1. \`ls docs/\`
-2. \`ls docs/nuxt/\`
-3. \`ls docs/nuxt/1.getting-started/\`
-4. \`cat docs/nuxt/1.getting-started/1.introduction.md\`
-5. \`cat docs/nuxt/1.getting-started/2.installation.md\`
+**Bad** — 5+ calls:
+1. \`find docs/ -maxdepth 2 -type d\`
+2. \`grep -rl "keyword" docs/source1/\`
+3. \`grep -rl "keyword" docs/source2/\`
+4. \`cat docs/source1/file1.md\`
+5. \`cat docs/source2/file2.md\`
## Rules
- **ALWAYS provide a text answer.** If you run out of relevant search results, answer with what you have. Never end on a tool call without a final response.
- Do NOT output text between tool calls. Search silently, then provide your complete answer at the end.
-- Use \`| head -N\` to limit output from search commands.
-- Chain commands with \`&&\` when sequential: \`grep -rl "term" docs/ --include="*.md" | head -5 && cat docs/path/file.md\`
+- Use \`| head -N\` on all search output to keep context small.
+- Use \`grep -rlE "term1\\|term2"\` for multi-keyword search in one command.
- Prefer \`grep -rl\` over \`grep -r\` — file paths are more useful than content dumps.
-- 2–3 targeted commands beats 10 exploratory ones.
+- 1–2 batched calls beats 5 sequential ones.
## Response Style
diff --git a/apps/chat/server/utils/prompts/shared.ts b/apps/chat/server/utils/prompts/shared.ts
index 871cc14..2873cd8 100644
--- a/apps/chat/server/utils/prompts/shared.ts
+++ b/apps/chat/server/utils/prompts/shared.ts
@@ -39,20 +39,12 @@ export function applyAgentConfig(basePrompt: string, config: AgentConfigData): s
export const COMPLEXITY_HINTS: Record<AgentConfig['complexity'], string> = {
trivial: 'Respond directly without searching.',
- simple: `One search + one read, then answer:
-1. \`grep -rl "keyword" docs/ --include="*.md" | head -5\`
-2. \`head -100 docs/path/file.md\`
-3. **Answer immediately.**`,
- moderate: `Search → batch read → answer:
-1. \`find docs/ -maxdepth 2 -type d\` (orient yourself)
-2. \`grep -rl "keyword" docs/relevant-source/ --include="*.md" | head -10\`
-3. \`bash_batch\`: read top 3–5 files with \`head -100\`
-4. **Answer with what you found.**`,
- complex: `Systematic exploration, then answer:
-1. \`find docs/ -maxdepth 2 -type d\` (map the sources)
-2. Multiple targeted \`grep -rl\` searches across relevant directories
-3. \`bash_batch\`: read files in parallel, use \`grep -n -C3\` for specific sections
-4. Cross-reference sources, then **answer.**`,
+ simple:
+ 'One bash_batch call: search + read in parallel, then answer.\nbash_batch: ["grep -rl \'keyword\' docs/ --include=\'*.md\' | head -5", "head -100 docs/likely-source/index.md"]\nThen answer.',
+ moderate:
+ 'One bash_batch: parallel grep across likely directories, then one batch read.\nbash_batch: ["grep -rl \'keyword\' docs/source1/ --include=\'*.md\' | head -5", "grep -rl \'keyword\' docs/source2/ --include=\'*.md\' | head -5"]\nThen bash_batch: read the top results.\nAnswer with what you found.',
+ complex:
+ 'Wide search then deep read:\n1. bash_batch: parallel grep -rl across all relevant directories\n2. bash_batch: read top files with head -100, use grep -n -C3 for specific sections\n3. Cross-reference sources, then answer.',
}
export function applyComplexity(prompt: string, agentConfig: AgentConfig): string {
diff --git a/packages/sdk/src/tools/shell.ts b/packages/sdk/src/tools/shell.ts
index 36cff2a..dce842d 100644
--- a/packages/sdk/src/tools/shell.ts
+++ b/packages/sdk/src/tools/shell.ts
@@ -82,15 +82,22 @@ Use standard Unix commands to explore and read files.`,
export function createBashBatchTool(client: SavoirClient, onToolCall?: ToolCallCallback) {
return tool({
description: `Execute multiple bash commands in the documentation sandbox in a single request.
-More efficient than multiple single bash calls. Commands run sequentially.
-Use when you need to run several related commands (e.g., list + read multiple files).
+More efficient than multiple single bash calls — use this as your primary tool.
+Combine search (grep) and read (head/cat) commands in a single batch.
Maximum 10 commands per batch.`,
inputSchema: z.object({
commands: z.array(z.string()).min(1).max(10).describe('Array of bash commands to execute'),
}),
inputExamples: [
- { input: { commands: ['head -80 docs/getting-started.md', 'head -80 docs/installation.md'] } },
- { input: { commands: ['grep -rl "routing" docs/ --include="*.md" | head -5', 'cat docs/api/reference.md'] } },
+ { input: { commands: [
+ 'grep -rl "useAsyncData" docs/ --include="*.md" | head -5',
+ 'head -80 docs/nuxt/1.getting-started/1.introduction.md',
+ ] } },
+ { input: { commands: [
+ 'grep -rl "routing" docs/nuxt/ --include="*.md" | head -5',
+ 'grep -rl "routing" docs/nitro/ --include="*.md" | head -5',
+ 'head -80 docs/nuxt/1.getting-started/3.routing.md',
+ ] } },
],
onInputAvailable: ({ toolCallId, input }) => {
onToolCall?.({