From b0b62fdf7491d33b33976e78c746bbd4e71d05c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Jan 2026 19:45:21 +0000 Subject: [PATCH 1/2] Add system prompt guidance for web content and background agents - Add Web Content section recommending spawn_agent for HTML content extraction to preserve main context - Expand Background Execution section with sleep command guidance for autonomous background task monitoring --- src/app.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app.rs b/src/app.rs index 68af0da..f9e0318 100644 --- a/src/app.rs +++ b/src/app.rs @@ -72,10 +72,15 @@ You have access to the following tools: - Use `ls` for directory exploration - Use `grep` or `rg` for searching code +### Web Content +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. + ### Background Execution 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. Use `list_background_tasks` to check status and `get_background_task` to retrieve results when complete. +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. + ### General - Be concise but thorough - Explain what you're doing before executing tools From 168f4ac91d9d3388c4e11fd5e94f615f283ce26a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Jan 2026 19:48:32 +0000 Subject: [PATCH 2/2] Add shell command guidance for relative paths and working directory - Recommend running pwd early to confirm working directory - Prefer relative paths over absolute paths for tool approval compatibility - Discourage using cd before commands; use relative paths instead --- src/app.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app.rs b/src/app.rs index f9e0318..6dfeb8e 100644 --- a/src/app.rs +++ b/src/app.rs @@ -71,6 +71,9 @@ You have access to the following tools: - Prefer `read_file` over `cat`, `head`, `tail` - Use `ls` for directory exploration - Use `grep` or `rg` for searching code +- Run `pwd` early in your session to confirm your working directory +- 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 +- 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`) ### Web Content 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.