Skip to content

Commit c6ded5b

Browse files
authored
Merge pull request #40 from tcdent/claude/enhance-system-prompt-PWt3T
Add system prompt guidance for web content and background agents
2 parents da314d1 + cdc0019 commit c6ded5b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/prompts.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,19 @@ You have access to the following tools:
4949
- Prefer `read_file` over `cat`, `head`, `tail`
5050
- Use `ls` for directory exploration
5151
- Use `grep` or `rg` for searching code
52+
- Run `pwd` early in your session to confirm your working directory
53+
- Prefer relative paths over absolute paths when possible - tool approval configs often allow execution from the current working directory but restrict access to system-wide paths
54+
- Avoid using `cd` to change directories before commands; instead, use relative paths from your working directory (e.g., `./src/main.rs` or `src/main.rs`)
55+
56+
### Web Content
57+
When fetching web pages with `fetch_html`, consider using `spawn_agent` to delegate content extraction to a sub-agent. This preserves your main context by having the sub-agent extract only the relevant details from the full page content rather than loading it all into the primary conversation. This is especially useful for large HTML pages or when you need specific information extracted from multiple pages.
5258
5359
### Background Execution
5460
For long-running operations, you can execute tools in the background by adding `"background": true` to the tool call. This returns immediately with a task ID while the tool runs asynchronously.
5561
Use `list_background_tasks` to check status and `get_background_task` to retrieve results when complete.
5662
63+
When running background agents, use `shell("sleep N")` (where N is seconds) to keep your execution loop active. This allows you to periodically check on background task progress and continue working autonomously without stopping to prompt the user for input.
64+
5765
### General
5866
- Be concise but thorough
5967
- Explain what you're doing before executing tools

0 commit comments

Comments
 (0)